我正在尝试使用wiredep注入bower依赖项。我对它是如何工作的,以及为什么它只适用于我的JS文件感到有点困惑。
gulp.task('wiredep', function(cb){
gulp.src('./index.html')
.pipe(wiredep())
.pipe(gulp.dest('.'));
});最后一行gulp.dest('.')做什么?目标不是我的index.html文件吗?而且,这个任务似乎只注入javascript文件。我的bower.json依赖项中包含
"bootstrap": "~3.3.6",
"bourbon": "~4.2.6",
"jquery": "~2.1.4",
"neat": "~1.7.2"Bootstrap、Bourbon和neat都有大量的CSS,但是
<!-- bower:css -->
<!-- endbower -->运行gulp wiredep后保留为空。为什么会这样呢?
bower.json deps如下所示:
"dependencies": {
"angular": "~1.4.8",
"bitters": "~1.1.0",
"bourbon": "~4.2.6",
"font-awesome": "fontawesome#~4.5.0",
"jquery": "~2.1.4",
"neat": "~1.7.2"
}发布于 2015-11-26 02:00:00
首先,将bootstrap博客中的官方解决方法添加到项目的bower.json文件中:
"dependencies": {
...
},
"overrides": {
"bootstrap": {
"main": [
"dist/js/bootstrap.js",
"dist/css/bootstrap.css",
"less/bootstrap.less"
]
}
}对于其他包,模式是相同的,但更改了路径。
https://stackoverflow.com/questions/33923233
复制相似问题