Search code examples
gruntjsbower-install

How to use grunt-bower-install to update multiple html files


I'm using the grunt file generated by yeoman angular-generator. There are multiple files need bower-install to update, the bower-install config is now like

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

I tried to use

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

And when running grunt bower-install, I got the following error

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

Aborted due to warnings.

The bower-install plugin version is

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

And my question is does this version support update multiple html files? If yes, how?


Solution

  • You can define multiple targets to update multiple html files like this:

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