ericclemmons / grunt-angular-templates

Grunt build task to concatenate & pre-load your AngularJS templates
MIT License
710 stars 107 forks source link

"module" property not respected #105

Closed SQLCODE917 closed 9 years ago

SQLCODE917 commented 10 years ago

Given config like

ngtemplates: {
  build: {
    module: 'myApp',
    cwd: '<%= yeoman.app %>',
    src: 'views/**/*.html',
    dest: '.tmp/concat/scripts/templates.js',
    options: {
      htmlmin: '<%= htmlmin.dist.options %>'
    }
  }

The output file begins like

angular.module('build').run(['$templateCache', function($templateCache) {
....

Given config like

ngtemplates: {
  myApp: {
    cwd: '<%= yeoman.app %>',
    src: 'views/**/*.html',
    dest: '.tmp/concat/scripts/templates.js',
    options: {
      htmlmin: '<%= htmlmin.dist.options %>'
    }
  }

The output file begins like

angular.module('myApp').run(['$templateCache', function($templateCache) {
....

This behavior prevents me from configuring ngtemplates for >1 goal.

Using grunt-angular-templates 0.5.7, Angular 1.2.16 and Grunt 0.4.4

gladwig commented 10 years ago

You need to put 'module' under 'options', i.e:

ngtemplates: {
  build: {
    cwd: '<%= yeoman.app %>',
    src: 'views/**/*.html',
    dest: '.tmp/concat/scripts/templates.js',
    options: {
      module: 'myApp',
      htmlmin: '<%= htmlmin.dist.options %>'
    }
  }
SQLCODE917 commented 9 years ago

Thank you!