gruntjs - 使用 Grunt 在 HTML 中插入 Bower devdependencies

标签 gruntjs bower yeoman-generator-angular

我通过 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/

相关文章:

image - grunt-contrib-imagemin 输出 "Fatal error: ENOENT, no such file or directory"

node.js - 如何使用 grunt.log 记录彩色消息

javascript - 在将 javascript 文件合并为一个文件之前我应该​​知道什么?

linux - 关于包管理的操作系统注意事项

maven - 如何使用带有 Maven 的 typescript 配置 Angular2 应用程序?

javascript - Bower:找不到适合 Angular 的版本

yeoman - yo angular 在错误的路径(主目录)中生成文件

ruby - jekyll 观看 haml 和 sass

javascript - Yeoman.io 在安装 generator-angular 时出现问题

node.js - Yeoman angularjs 脚手架错误