Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Commit

Permalink
feat(app): add grunt-angular-templates to the build
Browse files Browse the repository at this point in the history
Support using template cache for views instead of loading over http

Closes #277
  • Loading branch information
eddiemonge committed Apr 27, 2015
1 parent e60b1b5 commit b7b72b0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
23 changes: 20 additions & 3 deletions templates/common/root/_Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,16 @@ module.exports = function (grunt) {
usemin: {
html: ['<%%= yeoman.dist %>/{,*/}*.html'],
css: ['<%%= yeoman.dist %>/styles/{,*/}*.css'],
js: ['<%%= yeoman.dist %>/scripts/{,*/}*.js'],
options: {
assetsDirs: [
'<%%= yeoman.dist %>',
'<%%= yeoman.dist %>/images',
'<%%= yeoman.dist %>/styles'
]
],
patterns: {
js: [[/(images\/[^''""]*\.(png|jpg|jpeg|gif|webp|svg))/g, 'Replacing references to images']]
}
}
},

Expand Down Expand Up @@ -386,12 +390,25 @@ module.exports = function (grunt) {
files: [{
expand: true,
cwd: '<%%= yeoman.dist %>',
src: ['*.html', 'views/{,*/}*.html'],
src: ['*.html'],
dest: '<%%= yeoman.dist %>'
}]
}
},

ngtemplates: {
dist: {
options: {
module: '<%= scriptAppName %>',
htmlmin: '<%%= htmlmin.dist.options %>',
usemin: 'scripts/scripts.js'
},
cwd: '<%%= yeoman.app %>',
src: 'views/{,*/}*.html',
dest: 'templateCache.js'
}
},

// ng-annotate tries to make the code safe for minification automatically
// by using the Angular long form for dependency injection.
ngAnnotate: {
Expand Down Expand Up @@ -424,7 +441,6 @@ module.exports = function (grunt) {
'*.{ico,png,txt}',
'.htaccess',
'*.html',
'views/{,*/}*.html',
'images/{,*/}*.{webp}',
'styles/fonts/{,*/}*.*'
]
Expand Down Expand Up @@ -524,6 +540,7 @@ module.exports = function (grunt) {
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'ngtemplates',
'concat',
'ngAnnotate',
'copy:dist',
Expand Down
1 change: 1 addition & 0 deletions templates/common/root/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"private": true,
"devDependencies": {
"grunt": "^0.4.5",
"grunt-angular-templates": "^0.5.7",
"grunt-autoprefixer": "^2.0.0",
"grunt-concurrent": "^1.0.0",
"grunt-contrib-clean": "^0.6.0",<% if (coffee) { %>
Expand Down

0 comments on commit b7b72b0

Please sign in to comment.