我通过 Yeoman 脚手架安装了 AngularJS。当我跑
grunt bower-install
它仅在 HTML 中反射(reflect) bower.json 中“依赖项”部分下的依赖项。
如何使它包含“devDependencies”部分下的 deps?
最佳答案
如 Angular 更改日志中所述, bower-install 在 9.0.0 版本中已弃用 see here ,现在 bower-install 任务已弃用,应替换为wiredep。
使用以下内容编辑 Gruntfile.js 文件:
wiredep: {
options: {
cwd: '<%= yeoman.app %>'
},
dev: {
devDependencies: true,
src: ['<%= yeoman.app %>/index.html'],
ignorePath: /\.\.\//
},
app: {
src: ['<%= yeoman.app %>/index.html'],
ignorePath: /\.\.\//
},
sass: {
src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
ignorePath: /(\.\.\/){1,2}bower_components\//
}
},
现在安装 DevDependencies
grunt wiredep:dev
关于gruntjs - 使用 Grunt 在 HTML 中插入 Bower devdependencies,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25049246/