gpt4 book ai didi

javascript - Wiredep 不会插入 bower CSS 依赖项

转载 作者:IT老高 更新时间:2023-10-28 23:21:57 28 4
gpt4 key购买 nike

我正在尝试使用 wiredep 来注入(inject) bower 依赖项。我对它的工作原理以及为什么它只适用于我的 JS 文件感到有些困惑。

gulp.task('wiredep', function(cb){
gulp.src('./index.html')
.pipe(wiredep())
.pipe(gulp.dest('.'));
});

最后一行 gulp.dest('.') 做了什么?目的地不会是我的 index.html 文件。此外,此任务似乎只注入(inject) javascript 文件。我的 bower.json 依赖项中有

"bootstrap": "~3.3.6",
"bourbon": "~4.2.6",
"jquery": "~2.1.4",
"neat": "~1.7.2"

Bootstrap、Bourbon 和整洁,都有大量的 CSS,但是

<!-- bower:css -->
<!-- endbower -->

在运行 gulpwiredep 后保持为空。为什么会这样?

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"
}

最佳答案

首先将 bootstrap 博客中的官方解决方法添加到项目的 bower.json 文件中:

"dependencies": {
...
},
"overrides": {
"bootstrap": {
"main": [
"dist/js/bootstrap.js",
"dist/css/bootstrap.css",
"less/bootstrap.less"
]
}
}

对于其他包,模式相同,但路径有所不同。

关于javascript - Wiredep 不会插入 bower CSS 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33923233/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com