diff --git a/templates/common/root/_Gruntfile.js b/templates/common/root/_Gruntfile.js index 7786cd09d..5ea52745a 100644 --- a/templates/common/root/_Gruntfile.js +++ b/templates/common/root/_Gruntfile.js @@ -363,7 +363,7 @@ module.exports = function (grunt) { // concat, minify and revision files. Creates configurations in memory so // additional tasks can operate on them useminPrepare: { - html: '<%%= yeoman.app %>/index.html', + html: '<%%= yeoman.dist %>/index.html', options: { dest: '<%%= yeoman.dist %>', flow: { @@ -391,6 +391,17 @@ module.exports = function (grunt) { ], patterns: { js: [[/(images\/[^''""]*\.(png|jpg|jpeg|gif|webp|svg))/g, 'Replacing references to images']] + }, + blockReplacements: { + // Include cdnified scripts followed by usemin dest script + js: function (block) { + var scripts = block.src.filter(function (src) { + return src.startsWith('//'); + }).concat(block.dest); + return scripts.map(function (src) { + return ''; + }).join('\n'); + } } } }, @@ -495,6 +506,14 @@ module.exports = function (grunt) { // Copies remaining files to places other tasks can use copy: { + html: { + files: [{ + expand: true, + cwd: '<%= yeoman.app %>', + src: '*.html', + dest: '<%= yeoman.dist %>', + }], + }, dist: { files: [{ expand: true, @@ -503,7 +522,6 @@ module.exports = function (grunt) { dest: '<%%= yeoman.dist %>', src: [ '*.{ico,png,txt}', - '*.html', 'images/{,*/}*.{webp}', 'styles/fonts/{,*/}*.*' ] @@ -606,6 +624,8 @@ module.exports = function (grunt) { 'clean:dist', 'wiredep',<% if (typescript) { %> 'tsd:refresh',<% } %> + 'copy:html', + 'cdnify', 'useminPrepare', 'concurrent:dist', 'postcss', @@ -613,7 +633,6 @@ module.exports = function (grunt) { 'concat', 'ngAnnotate', 'copy:dist', - 'cdnify', 'cssmin', 'uglify', 'filerev', diff --git a/templates/common/root/_package.json b/templates/common/root/_package.json index 24e2dcf7e..3ddbc3a4b 100644 --- a/templates/common/root/_package.json +++ b/templates/common/root/_package.json @@ -45,7 +45,7 @@ "grunt-contrib-uglify": "^0.7.0", "grunt-contrib-watch": "^0.6.1", "grunt-filerev": "^2.1.2", - "grunt-google-cdn": "^0.4.3",<% if (!coffee) { %> + "grunt-google-cdn": "github:btford/grunt-google-cdn#bca6658",<% if (!coffee) { %> "grunt-jscs": "^1.8.0",<% } %> "grunt-newer": "^1.1.0", "grunt-ng-annotate": "^0.9.2",