Skip to content

Commit 7b940da

Browse files
committed
chore(app:grunt): improve grunt config template usage
1 parent 44aa8f5 commit 7b940da

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

Diff for: app/templates/Gruntfile.js

+26-21
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ module.exports = function (grunt) {
265265
filerev: {
266266
dist: {
267267
src: [
268-
'<%%= yeoman.dist %>/client/!(bower_components){,*/}*.{js,css}',
269-
'<%%= yeoman.dist %>/client/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
270-
'<%%= yeoman.dist %>/client/assets/fonts/*'
268+
'<%%= yeoman.dist %>/<%%= yeoman.client %>/!(bower_components){,*/}*.{js,css}',
269+
'<%%= yeoman.dist %>/<%%= yeoman.client %>/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
270+
'<%%= yeoman.dist %>/<%%= yeoman.client %>/assets/fonts/*'
271271
]
272272
}
273273
},
@@ -278,19 +278,19 @@ module.exports = function (grunt) {
278278
useminPrepare: {
279279
html: ['<%%= yeoman.client %>/index.html'],
280280
options: {
281-
dest: '<%%= yeoman.dist %>/client'
281+
dest: '<%%= yeoman.dist %>/<%%= yeoman.client %>'
282282
}
283283
},
284284

285285
// Performs rewrites based on rev and the useminPrepare configuration
286286
usemin: {
287-
html: ['<%%= yeoman.dist %>/client/{,!(bower_components)/**/}*.html'],
288-
css: ['<%%= yeoman.dist %>/client/!(bower_components){,*/}*.css'],
289-
js: ['<%%= yeoman.dist %>/client/!(bower_components){,*/}*.js'],
287+
html: ['<%%= yeoman.dist %>/<%%= yeoman.client %>/{,!(bower_components)/**/}*.html'],
288+
css: ['<%%= yeoman.dist %>/<%%= yeoman.client %>/!(bower_components){,*/}*.css'],
289+
js: ['<%%= yeoman.dist %>/<%%= yeoman.client %>/!(bower_components){,*/}*.js'],
290290
options: {
291291
assetsDirs: [
292-
'<%%= yeoman.dist %>/client',
293-
'<%%= yeoman.dist %>/client/assets/images'
292+
'<%%= yeoman.dist %>/<%%= yeoman.client %>',
293+
'<%%= yeoman.dist %>/<%%= yeoman.client %>/assets/images'
294294
],
295295
// This is so we update image references in our ng-templates
296296
patterns: {
@@ -308,7 +308,7 @@ module.exports = function (grunt) {
308308
expand: true,
309309
cwd: '<%%= yeoman.client %>/assets/images',
310310
src: '{,*/}*.{png,jpg,jpeg,gif,svg}',
311-
dest: '<%%= yeoman.dist %>/client/assets/images'
311+
dest: '<%%= yeoman.dist %>/<%%= yeoman.client %>/assets/images'
312312
}]
313313
}
314314
},
@@ -357,7 +357,7 @@ module.exports = function (grunt) {
357357
// Replace Google CDN references
358358
cdnify: {
359359
dist: {
360-
html: ['<%%= yeoman.dist %>/client/*.html']
360+
html: ['<%%= yeoman.dist %>/<%%= yeoman.client %>/*.html']
361361
}
362362
},
363363

@@ -368,7 +368,7 @@ module.exports = function (grunt) {
368368
expand: true,
369369
dot: true,
370370
cwd: '<%%= yeoman.client %>',
371-
dest: '<%%= yeoman.dist %>/client',
371+
dest: '<%%= yeoman.dist %>/<%%= yeoman.client %>',
372372
src: [
373373
'*.{ico,png,txt}',
374374
'.htaccess',
@@ -380,7 +380,7 @@ module.exports = function (grunt) {
380380
}, {
381381
expand: true,
382382
cwd: '.tmp/images',
383-
dest: '<%%= yeoman.dist %>/client/assets/images',
383+
dest: '<%%= yeoman.dist %>/<%%= yeoman.client %>/assets/images',
384384
src: ['generated/*']
385385
}, {
386386
expand: true,
@@ -623,7 +623,8 @@ module.exports = function (grunt) {
623623
scripts: {
624624
options: {
625625
transform: function(filePath) {
626-
filePath = filePath.replace('/client/', '');
626+
var yoClient = grunt.config.get('yeoman.client');
627+
filePath = filePath.replace('/' + yoClient + '/', '');
627628
filePath = filePath.replace('/.tmp/', '');
628629
return '<script src="' + filePath + '"></script>';
629630
},
@@ -645,8 +646,9 @@ module.exports = function (grunt) {
645646
stylus: {
646647
options: {
647648
transform: function(filePath) {
648-
filePath = filePath.replace('/client/app/', '');
649-
filePath = filePath.replace('/client/components/', '../components/');
649+
var yoClient = grunt.config.get('yeoman.client');
650+
filePath = filePath.replace('/' + yoClient + '/app/', '');
651+
filePath = filePath.replace('/' + yoClient + '/components/', '../components/');
650652
return '@import \'' + filePath + '\';';
651653
},
652654
starttag: '// injector',
@@ -664,8 +666,9 @@ module.exports = function (grunt) {
664666
sass: {
665667
options: {
666668
transform: function(filePath) {
667-
filePath = filePath.replace('/client/app/', '');
668-
filePath = filePath.replace('/client/components/', '../components/');
669+
var yoClient = grunt.config.get('yeoman.client');
670+
filePath = filePath.replace('/' + yoClient + '/app/', '');
671+
filePath = filePath.replace('/' + yoClient + '/components/', '../components/');
669672
return '@import \'' + filePath + '\';';
670673
},
671674
starttag: '// injector',
@@ -683,8 +686,9 @@ module.exports = function (grunt) {
683686
less: {
684687
options: {
685688
transform: function(filePath) {
686-
filePath = filePath.replace('/client/app/', '');
687-
filePath = filePath.replace('/client/components/', '../components/');
689+
var yoClient = grunt.config.get('yeoman.client');
690+
filePath = filePath.replace('/' + yoClient + '/app/', '');
691+
filePath = filePath.replace('/' + yoClient + '/components/', '../components/');
688692
return '@import \'' + filePath + '\';';
689693
},
690694
starttag: '// injector',
@@ -702,7 +706,8 @@ module.exports = function (grunt) {
702706
css: {
703707
options: {
704708
transform: function(filePath) {
705-
filePath = filePath.replace('/client/', '');
709+
var yoClient = grunt.config.get('yeoman.client');
710+
filePath = filePath.replace('/' + yoClient + '/', '');
706711
filePath = filePath.replace('/.tmp/', '');
707712
return '<link rel="stylesheet" href="' + filePath + '">';
708713
},

0 commit comments

Comments
 (0)