Integrating uglify.
Showing
2 changed files
with
28 additions
and
6 deletions
... | @@ -204,6 +204,12 @@ module.exports = function (grunt) { | ... | @@ -204,6 +204,12 @@ module.exports = function (grunt) { |
204 | htmlSourceDir = 'src'; | 204 | htmlSourceDir = 'src'; |
205 | } | 205 | } |
206 | 206 | ||
207 | if (mpConfig.uglify) { | ||
208 | initConfig.uglify = { | ||
209 | options: mpConfig.uglify, | ||
210 | }; | ||
211 | } | ||
212 | |||
207 | if (true) { | 213 | if (true) { |
208 | initConfig.useminPrepare = { | 214 | initConfig.useminPrepare = { |
209 | options: { | 215 | options: { |
... | @@ -327,6 +333,19 @@ module.exports = function (grunt) { | ... | @@ -327,6 +333,19 @@ module.exports = function (grunt) { |
327 | install: {}, | 333 | install: {}, |
328 | update: {}, | 334 | update: {}, |
329 | }; | 335 | }; |
336 | if (mpConfig.uglify) { | ||
337 | initConfig.uglify.montyPython = { | ||
338 | files: [{ | ||
339 | expand: true, | ||
340 | dot: true, | ||
341 | cwd: 'dist/' + mpConfig.bower.directory, | ||
342 | dest: 'dist/' + mpConfig.bower.directory, | ||
343 | src: [ | ||
344 | '**/*.js', | ||
345 | ] | ||
346 | }] | ||
347 | }; | ||
348 | } | ||
330 | if (mpConfig.useRev) { | 349 | if (mpConfig.useRev) { |
331 | initConfig.rev.dist.files.push({ | 350 | initConfig.rev.dist.files.push({ |
332 | src: [ | 351 | src: [ |
... | @@ -417,7 +436,6 @@ module.exports = function (grunt) { | ... | @@ -417,7 +436,6 @@ module.exports = function (grunt) { |
417 | }; | 436 | }; |
418 | } | 437 | } |
419 | 438 | ||
420 | |||
421 | grunt.initConfig(initConfig); | 439 | grunt.initConfig(initConfig); |
422 | 440 | ||
423 | grunt.registerTask('check', checkList); | 441 | grunt.registerTask('check', checkList); |
... | @@ -442,7 +460,7 @@ module.exports = function (grunt) { | ... | @@ -442,7 +460,7 @@ module.exports = function (grunt) { |
442 | 'container = (container[propName] = container[propName] || {});', | 460 | 'container = (container[propName] = container[propName] || {});', |
443 | ]; | 461 | ]; |
444 | for (var flag in featureFlags) { | 462 | for (var flag in featureFlags) { |
445 | lines.push('require.config.featureFlags[' + JSON.stringify(flag) + ']=' + JSON.stringify(featureFlags[flag]) + ';'); | 463 | lines.push('container[' + JSON.stringify(flag) + ']=' + JSON.stringify(featureFlags[flag]) + ';'); |
446 | } | 464 | } |
447 | //lines.push('return bundles;'); | 465 | //lines.push('return bundles;'); |
448 | lines.push('})(require.config, \'featureFlags\');'); | 466 | lines.push('})(require.config, \'featureFlags\');'); |
... | @@ -451,7 +469,7 @@ module.exports = function (grunt) { | ... | @@ -451,7 +469,7 @@ module.exports = function (grunt) { |
451 | } | 469 | } |
452 | grunt.file.write('.grunt/holygrail/scripts/featureFlags.js', lines.join('\n')); | 470 | grunt.file.write('.grunt/holygrail/scripts/featureFlags.js', lines.join('\n')); |
453 | }); | 471 | }); |
454 | buildList.add('writeFeatureFlags'); | 472 | buildList.push('writeFeatureFlags'); |
455 | } | 473 | } |
456 | 474 | ||
457 | if (mpConfig.punch) { | 475 | if (mpConfig.punch) { |
... | @@ -476,7 +494,9 @@ module.exports = function (grunt) { | ... | @@ -476,7 +494,9 @@ module.exports = function (grunt) { |
476 | //'uglify:dist'); | 494 | //'uglify:dist'); |
477 | buildList.push('copy:dist'); | 495 | buildList.push('copy:dist'); |
478 | //'modernizr'); | 496 | //'modernizr'); |
479 | //buildList.push('uglify:generated'); // montyPython | 497 | if (mpConfig.uglify) { |
498 | buildList.push('uglify:generated'); // montyPython | ||
499 | } | ||
480 | if (mpConfig.useRev) { | 500 | if (mpConfig.useRev) { |
481 | buildList.push('rev:dist'); // montyPython | 501 | buildList.push('rev:dist'); // montyPython |
482 | buildList.push('rev:css'); // montyPython | 502 | buildList.push('rev:css'); // montyPython |
... | @@ -488,8 +508,9 @@ module.exports = function (grunt) { | ... | @@ -488,8 +508,9 @@ module.exports = function (grunt) { |
488 | if (mpConfig.useRev) { | 508 | if (mpConfig.useRev) { |
489 | buildList.push('rev:requirejs'); | 509 | buildList.push('rev:requirejs'); |
490 | } | 510 | } |
491 | //buildList.push('uglify:bower'); // montyPython | 511 | if (mpConfig.bower && mpConfig.uglify) { |
492 | //buildList.push('uglify:requireconfig'); // montyPython | 512 | buildList.push('uglify:montyPython'); // montyPython |
513 | } | ||
493 | buildList.push('usemin:html'); // montyPython | 514 | buildList.push('usemin:html'); // montyPython |
494 | buildList.push('usemin:css'); // montyPython | 515 | buildList.push('usemin:css'); // montyPython |
495 | buildList.push('htmlmin'); // montyPython | 516 | buildList.push('htmlmin'); // montyPython | ... | ... |
... | @@ -25,6 +25,7 @@ | ... | @@ -25,6 +25,7 @@ |
25 | "grunt-contrib-htmlmin": "~0", | 25 | "grunt-contrib-htmlmin": "~0", |
26 | "grunt-contrib-imagemin": "~0", | 26 | "grunt-contrib-imagemin": "~0", |
27 | "grunt-contrib-requirejs": "~0", | 27 | "grunt-contrib-requirejs": "~0", |
28 | "grunt-contrib-uglify": "~0", | ||
28 | "grunt-rev": "~0", | 29 | "grunt-rev": "~0", |
29 | "grunt-svgmin": "~0", | 30 | "grunt-svgmin": "~0", |
30 | "grunt-usemin": "~2", | 31 | "grunt-usemin": "~2", | ... | ... |
-
Please register or sign in to post a comment