- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试利用 grunt-wiredep 更改我在 spring-boot 项目中的源代码。
通过下拉 JS/CSS 和依赖项,使用 Bower 可以按预期工作,grunt-wiredep 将更新源代码,但由于我使用 thymeleaf 的方式,我需要用 @{URL_GOES_HERE} 将 URL 括起来。
这可能吗? grunt-wiredep 是否有前缀/后缀选项? (到目前为止我还没有找到)。
当前输出:
<!-- 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
可以利用 original wiredep
提供的任何配置选项.
在上面的链接中你可以看到输出格式也可以配置,github readme 给出了一个将随机类附加到脚本标签的例子:
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 fileExtension 配置 block :
html: {
block: /(([ \t]*)<!--\s*bower:*(\S*)\s*-->)(\n|\r|.)*?(<!--\s*endbower\s*-->)/gi,
detect: {
js: /<script.*src=['"]([^'"]+)/gi
},
replace: {
js: '<script src="@{\\{{filePath}}}"></script>'
}
},
关于javascript - 谁可以为 grunt-wiredep 生成的 URL 添加前缀和后缀?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31989532/
是否可以通过 grunt-wiredep 任务注入(inject)我自己的 js 文件夹?有解决办法吗? 编辑 我找到了grunt-inject ,但我使用的是 Jade View 引擎(该解决方案仅
我的应用程序的目录如下 app -> appName -> index.html (js,css) 出于某种原因,这个 appName 包装文件夹搞乱了wiredire { dest: '.tmp/c
当前的项目结构有点像这样: -index.html | -bower.json | +-bower_components 建议的项目结构将在项目根目录中添加更多静态 html 文件。到目前为止,我一直
我有一个由 Yeoman 生成的 Angularjs 项目。这是我的 bower.json 文件中的内容: { "name": "obikrang-test", "version": "0.0
gulpfile 在'web'中 “网络”中的 bower_components 目录结构: web > app > jade > layout.jade (target) 使用: gulp.task
每次我使用 Bower 安装任何依赖项时,都会将我所有的依赖项包含到我的 index.html 中,这太完美了! The problem: 它分别返回我的所有文件,导致许多不必要的 HTTP 调用。我
我一直在尝试让 wiredep 和 gulp 为通过 Bower 加载(和 --save-dev)的脚本生成脚本标签和路径,如无数教程中所示,但无论我做什么,它都会很好地复制 html 源文件,但不会
我成功地使用 grunt-wiredep 包将 Bower 组件注入(inject)到我的 View 标记中,并且我目前正在将 View 从 HTML 移植到 Jade。但是,当我运行构建脚本时,bo
只要 wiredep grunt 任务运行,它就会删除 socketio。 ~/.g/p/g/g/s/b/f/brody % git diff diff --git a/app/app/index.h
简而言之,我使用 gruntwiredep 和 useminPrepare。我想将一些 Bower 依赖项合并到单个文件中。 HTML 标记 Wiredep 配置
我正在尝试使用 wiredep 来注入(inject) bower 依赖项。我对它的工作原理以及为什么它只适用于我的 JS 文件感到有些困惑。 gulp.task('wiredep', functio
运行“wiredep:target”(wiredep)任务 完成,没有错误 但不注入(inject) Bower.json 的依赖项。无法调试这个问题。如有任何帮助,我们将不胜感激。 Gruntfil
这是我的任务 gulp.task('inject', function() { var wiredep = require('wiredep').stream; var options = {
我有以下目录结构: bower_components node_modules src index.html bower.json package.json gulpfile.js .gitignor
我正在尝试利用 grunt-wiredep 更改我在 spring-boot 项目中的源代码。 通过下拉 JS/CSS 和依赖项,使用 Bower 可以按预期工作,grunt-wiredep 将更新源
我通过 bower(bower 安装基础)在我的 bower_components 中建立了基础。 我的 Gruntfile.js 中也有 grunt-wiredep,如下所示: wirede
每次由 gulp-less 编译后创建自定义 CSS 文件时,我都需要注入(inject)它们。所以我尝试将 wiredep 与自定义配置一起使用,但没有成功。我将标签从“bower:css”更改为“
我目前正在从事一个已经开始使用 yeoman 的项目。 出于某种原因,当我运行 grunt-wiredep 时,除了 font-awesome 之外,所有依赖项都被正确地注入(inject)到我的 i
我想修改一个 gulpfile.js 并将我的 bower_components/ 文件夹更改为 app/bower_components/。 我更新了 .bowerrc 中的目录,所以现在每次我执行
我有一个 index.html 文件。在我的 bower.json 文件中,我有一个依赖项: "bootstrap": "~3.3.2" 在我的 gulp 文件中: gulp.src('./mai
我是一名优秀的程序员,十分优秀!