我试图利用咕噜-线,以改变我的源代码在一个弹簧启动项目。
通过解压JS/CSS和依赖项,使用bower可以正常工作,而grunt-wiredep将更新源代码,但由于我使用thymeleaf的方式,我需要用@{URL_GOES_HERE}包围URL。
这个是可能的吗?是否有前缀/后缀选项?(到目前为止,我还没有发现这种情况)。
电流输出
<!-- bower-js:start -->
<script src="bower_components\bootstrap-colorpicker\js\bootstrap-colorpicker.js">
</script>
<!-- bower-js:end -->期望输出:
<!-- bower-js:start -->
<script src="@{\bower_components\bootstrap-colorpicker\js\bootstrap-colorpicker.js}">
</script>
<!-- bower-js:end -->发布于 2015-08-13 13:44:43
grunt-wiredep可以利用wiredep提供的任何配置选项。
在上面的链接中,您可以看到输出格式也可以配置,github自述be给出了一个在脚本标记中附加随机类的示例:
fileTypes: {
fileExtension: {
block: /match the beginning-to-end of a bower block in this type of file/,
detect: {
typeOfBowerFile: /match the way this type of file is included/
},
replace: {
typeOfBowerFile: '<format for this {{filePath}} to be injected>',
anotherTypeOfBowerFile: function (filePath) {
return '<script class="random-' + Math.random() + '" src="' + filePath + '"></script>';
}
}
}, //...因此,例如,您可以覆盖默认的HTML块,如下所示:
html: {
block: /(([ \t]*)<!--\s*bower:*(\S*)\s*-->)(\n|\r|.)*?(<!--\s*endbower\s*-->)/gi,
detect: {
js: /<script.*src=['"]([^'"]+)/gi
},
replace: {
js: '<script src="@{\\{{filePath}}}"></script>'
}
},https://stackoverflow.com/questions/31989532
复制相似问题