rquadling/grunt-html2js

Can anyone explain why this doesn't work?

Closed this issue · 4 comments

I have two completely different templates with differing options. And this structure works for most other grunt tasks. I get "Successfully converted 0 html templates to js" every time. Any help would be greatly appreciated. I'd rather not post my workaround code to solve this bug.

grunt.initConfig({
  html2js: {
    myapp: 
      options: {
        // custom options, see below
      },
      main: {
        src: ['src/**/*.tpl.html'],
        dest: 'tmp/templates.js'
      }
    }
    myotherapp: {
      options: {
        // custom options, see below
      },
      main: {
        src: ['common/**/*.tpl.html'],
        dest: 'tmp/templates_2.js'
      }
    }
  }
})

My solution allows for passing an array of strings in for the prefix, which is worthwhile and all but in this case would be an ugly work around for something grunt would usually just handle natively.

Does it work if you remove the 'main' block:

grunt.initConfig({
  html2js: {
    myapp: 
      options: {
        // custom options, see below
      },
      src: ['src/**/*.tpl.html'],
      dest: 'tmp/templates.js'
    },
    myotherapp: {
      options: {
        // custom options, see below
      },
      src: ['common/**/*.tpl.html'],
      dest: 'tmp/templates_2.js'
    }
  }
})

Thank you! I'm not sure why I was so stuck on having "main" added in there. It just didn't occur to me.

Great work on this BTW!