ericclemmons / grunt-angular-templates

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

template url-key starts with app/ folder? #122

Closed armyofda12mnkeys closed 9 years ago

armyofda12mnkeys commented 9 years ago

Just curious, I'm serving my app out of app/ like a normal angular project. When I run grunt to create the ngtemplates file, i see it creates they cache url-keys with 'app/' added which means they never get served when i see requests from my index.html for 'views/templates/textarea.html' when the file has the key 'app/views/templates/textarea.html'. I added a option for stripping app/ out of the cache key and it works, but just thought I'd ask if there is a better way to do this (by default i would assume it would work out of the app/ directory so thought I'd post here to see if its a bug or just a bad grunt setup I have).

ngtemplates: { screenerApp: { src: ["<%= yeoman.app %>/views/_.html", "<%= yeoman.app %>/views/templates/_/.html"], dest: ".tmp/views/templates/cached-templates.js", //base : 'app/' options: { url: function(url) { return url.replace('app/', ''); } } } } });

The base option didn't work for me either. But either way thought it would work without extra config since its a standard angular project setup in terms of folder structure i think.

Thanks, Ari

windmaomao commented 9 years ago

i have the same issue, you can use instead

ngtemplates: {
    app: {
        cwd: '<%= yeoman.app %>',
        src: "scripts/**/*.html",
        dest: ".tmp/scripts/templates.js"
    }
},
armyofda12mnkeys commented 9 years ago

thanks windmaomao, that worked for me