我把咕噜声和保龄球绑在一起。为了直接向index.html、、grunt-wiredep注入bower组件,使用了。
但是有一个问题,bower.json中存在的一些依赖项仍未包含在*.html中。
bower.json
{
"name": "***",
"version": "***",
"dependencies": {},
"devDependencies": {
"jquery": "~2.1.1",
"angular": "1.4.x",
"bootstrap": "~3.1.1",
...
},
"resolutions": {
..
}
}gruntfile.js
....
wiredep: {
task: {
src: [
'app/index.html'
],
options: {
dependencies: true,
devDependencies: true
}
}
}
...index.html
...
<!-- bower:js -->
<!-- endbower -->
<!-- bower:css -->
<!-- endbower -->
...因此,我没有为jquery提供脚本,没有为引导程序提供角、引导和css脚本。但还包括了其他一些消息来源。
问题不在bower.json内部这里的主属性中。
经过一些调查,我发现了带有引导3.3.x的问题
但是,在我的bower.js中“重写”块没有帮助。
有一件事似乎很有趣:(bootstarp也是如此)
加后
"jquery": {
"main": "D:/REPO/XX/current/bower_components/jquery/dist/jquery.js"
}若要重写块,wiredep已包含了以下index.html
<script src="../bower_components/jquery/D:/REPO/XX/current/bower_components/jquery/dist/jquery.js"></script>但是当我写完"main": "dist/jquery.js"时,它就被忽略了。
发布于 2016-02-02 14:57:53
在我看来,你对你的项目的结构有一些问题。使用cwd参数。我已经成功地将wiredep配置为使用config添加所需的依赖项:
wiredep: {
task: {
src: [
'<%= cfg.webapp_dir %>/index.html'
],
cwd: '.',
overrides': {
'bootstrap': {
'main': ['less/bootstrap.less', 'dist/css/bootstrap.min.css', 'dist/js/bootstrap.min.js']
}
},
fileTypes: {
html: {
replace: {
js: '<script src="/{{filePath}}"></script>',
css: '<link rel="stylesheet" href="/{{filePath}}" />'
}
}
}
}
}在我的示例中,bower_dependencies文件夹位于与index.html相同的目录中。
https://stackoverflow.com/questions/35154454
复制相似问题