b852be15 by Adam Heath

Add compression support.

For each file matching a list of supplied extensions, gzip will be used
to write a compressed copy, and placed along side the original.
1 parent 59c643b8
...@@ -717,6 +717,18 @@ module.exports = function (grunt) { ...@@ -717,6 +717,18 @@ module.exports = function (grunt) {
717 } 717 }
718 }; 718 };
719 } 719 }
720 if (mpConfig.gzip) {
721 initConfig.compress = {
722 dist: {
723 options: {
724 mode: 'gzip',
725 },
726 files: _.map(mpConfig.gzip.options.extensions, function(value) {
727 return {expand: true, cwd: 'dist/build', src: ['**/*.' + value], dest: 'dist/build', extDot: 'last', ext: '.' + value + '.gz'};
728 }),
729 },
730 };
731 }
720 732
721 grunt.initConfig(initConfig); 733 grunt.initConfig(initConfig);
722 grunt.config('montyPython.config', mpConfig); 734 grunt.config('montyPython.config', mpConfig);
...@@ -846,6 +858,9 @@ module.exports = function (grunt) { ...@@ -846,6 +858,9 @@ module.exports = function (grunt) {
846 } 858 }
847 buildList.push('do-use'); 859 buildList.push('do-use');
848 buildList.push('htmlmin'); // montyPython 860 buildList.push('htmlmin'); // montyPython
861 if (mpConfig.gzip) {
862 buildList.push('compress:dist');
863 }
849 buildList.push('deploy'); // montyPython 864 buildList.push('deploy'); // montyPython
850 865
851 grunt.task.run(buildList); 866 grunt.task.run(buildList);
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
18 "grunt": "", 18 "grunt": "",
19 "grunt-contrib-clean": "", 19 "grunt-contrib-clean": "",
20 "grunt-contrib-concat": "", 20 "grunt-contrib-concat": "",
21 "grunt-contrib-compress": "",
21 "grunt-contrib-copy": "", 22 "grunt-contrib-copy": "",
22 "grunt-contrib-csslint": "", 23 "grunt-contrib-csslint": "",
23 "grunt-contrib-cssmin": "", 24 "grunt-contrib-cssmin": "",
......