如何使用grunt-bower-install更新多个html文件

时间:2014-03-31 12:00:46

标签: gruntjs bower-install

我正在使用yeoman angular-generator生成的grunt文件。有多个文件需要bower-install才能更新,bower-install配置现在就像

// Automatically inject Bower components into the app
'bower-install': {
  app: {
    html: '<%= yeoman.app %>/index.html',
    ignorePath: '<%= yeoman.app %>/'
  }
},

我尝试使用

    html: ['<%= yeoman.app %>/index.html','<%= yeoman.app %>/manager.html']

运行grunt bower-install时,出现以下错误

Running "bower-install:app" (bower-install) task
Warning: path must be a string Use --force to continue.

Aborted due to warnings.

bower-install插件版本是

"grunt-bower-install": "~0.7.0",

我的问题是这个版本是否支持更新多个html文件?如果是,怎么样?

2 个答案:

答案 0 :(得分:2)

您可以定义多个目标来更新多个html文件,如下所示:

'bower-install': {
  app: {
    html: '<%= yeoman.app %>/index.html',
    ignorePath: '<%= yeoman.app %>/'
  },
  app2: {
    html: '<%= yeoman.app %>/manager.html',
    ignorePath: '<%= yeoman.app %>/'
  }
}

答案 1 :(得分:1)

看起来最新版本使用了一种更灵活的方式来定位注入文件......

https://github.com/stephenplusplus/grunt-bower-install

target: {
    ...
    src: [
      'app/views/**/*.html',
    ...