ericclemmons / grunt-angular-templates

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

ngtemplates task Warning: Object.keys called on non-object #56

Closed amayvs closed 11 years ago

amayvs commented 11 years ago

Trying to run grunt build on a Yeoman scaffolded app with grunt-angular-templates as one of the tasks, generates the following errors:

>> Tasks directory "grunt-angular-templates" not found.

Also gives the following error:

Running "ngtemplates:TestApp" (ngtemplates) task
Warning: Object.keys called on non-object Use --force to continue.

Isolated run command: grunt ngtemplates:TestApp

Link to TestApp below: Github repo

I'm not sure what is causing these errors.

ericclemmons commented 11 years ago

1st off, great issue :) Well doc'd, example code, the works!

I think I know the cause of this, and should have it patched shortly.

Thanks!

ericclemmons commented 11 years ago

1st, because you are using require('load-grunt-tasks')(grunt);, you won't need the grunt.loadTasks('grunt-angular-templates'); instruction on https://github.com/amayvs/TestApp/blob/master/Gruntfile.js#L368.

2nd, I found the root cause and am patching now. Thanks!

ericclemmons commented 11 years ago

BTW, here's the output of grunt ngtemplates now:

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

  $templateCache.put('views/main.html',
    "<div class=\"hero-unit\">\n" +
    "  <h1>'Allo, 'Allo!</h1>\n" +
    "  <p>You now have</p>\n" +
    "  <ul>\n" +
    "      <li ng-repeat=\"thing in awesomeThings\">{{thing}}</li>\n" +
    "  </ul>\n" +
    "  <p>installed.</p>\n" +
    "  <h3>Enjoy coding! - Yeoman</h3>\n" +
    "</div>\n"
  );

}]);
ericclemmons commented 11 years ago

Also, you're referencing htmlmin.app which doesn't exist. For now, I'd leave off the htmlmin part until you're ready to optimize your app.

https://github.com/amayvs/TestApp/blob/master/Gruntfile.js#L224 https://github.com/amayvs/TestApp/blob/master/Gruntfile.js#L228

amayvs commented 11 years ago

1st off, Thanks for fixing this so quickly. Appreciate it.

2nd, my bad, htmlmin.app was copied over from another app of mine.

Cheers