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

Fix cdnify #1242

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions templates/common/root/_Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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 '<script src="' + src + '"></script>';
}).join('\n');
}
}
}
},
Expand Down Expand Up @@ -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,
Expand All @@ -503,7 +522,6 @@ module.exports = function (grunt) {
dest: '<%%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'*.html',
'images/{,*/}*.{webp}',
'styles/fonts/{,*/}*.*'
]
Expand Down Expand Up @@ -606,14 +624,15 @@ module.exports = function (grunt) {
'clean:dist',
'wiredep',<% if (typescript) { %>
'tsd:refresh',<% } %>
'copy:html',
'cdnify',
'useminPrepare',
'concurrent:dist',
'postcss',
'ngtemplates',
'concat',
'ngAnnotate',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'filerev',
Expand Down
2 changes: 1 addition & 1 deletion templates/common/root/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down