谁可以在grunt- wiredp生成的URL's上添加前缀和后缀?
Who can i append a prefix and a suffix to the URL's generated by grunt-wiredep?
我正在尝试使用grunt- wiredp来修改我的spring-boot项目中的源代码。
使用bower可以通过下拉JS/CSS和依赖项来工作,并且grunt-wiredep将更新源代码,但是由于我使用thymeleaf的方式,我需要用@{URL_GOES_HERE}包围URL。
这可能吗?grunt- wiredp有前缀/后缀选项吗?(到目前为止我还没有找到这个)。
电流输出:
<!-- 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 -->
grunt-wiredep
可以使用原始wiredep
提供的任何配置选项。
在上面的链接中,你可以看到输出格式也可以配置,github自述文件给出了一个向脚本标签附加随机类的示例:
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>'
}
},
相关文章:
- 如何在Phonegap中进行AJAX调用时添加加载屏幕
- 如何在加载前添加加载动画
- 如何在网页加载之前添加加载页面
- 在谷歌地图上添加加载叠加层
- 无法添加加载栏(角度)
- 在 PHP 脚本运行时添加加载图像
- 如何在博主上添加“加载更多”按钮
- 如何为AngularJS路由添加动态前缀
- 使用jQuery Ajax添加加载和错误文本
- Jquery Ajax HTML -添加加载
- 如何在javascript,jquery和php中添加加载,同时执行
- Jquery在添加加载额外内容的脚本后停止工作
- 在使用jQuery返回表单数据之前,不要添加加载类
- 解析服务添加加载事件
- 如何在加载所有资源之前添加加载效果?
- 在提交表单时添加加载gif
- 如何添加加载文本
- 添加加载指示每当应用程序停滞
- 我如何给一个号码加前缀和加零?
- 如何添加加载标志,而ajax从其他PHP文件中获取数据,并将其返回到当前页面