e958f8b5 by Adam Heath

Integrating uglify.

1 parent a421f05b
......@@ -204,6 +204,12 @@ module.exports = function (grunt) {
htmlSourceDir = 'src';
}
if (mpConfig.uglify) {
initConfig.uglify = {
options: mpConfig.uglify,
};
}
if (true) {
initConfig.useminPrepare = {
options: {
......@@ -327,6 +333,19 @@ module.exports = function (grunt) {
install: {},
update: {},
};
if (mpConfig.uglify) {
initConfig.uglify.montyPython = {
files: [{
expand: true,
dot: true,
cwd: 'dist/' + mpConfig.bower.directory,
dest: 'dist/' + mpConfig.bower.directory,
src: [
'**/*.js',
]
}]
};
}
if (mpConfig.useRev) {
initConfig.rev.dist.files.push({
src: [
......@@ -417,7 +436,6 @@ module.exports = function (grunt) {
};
}
grunt.initConfig(initConfig);
grunt.registerTask('check', checkList);
......@@ -442,7 +460,7 @@ module.exports = function (grunt) {
'container = (container[propName] = container[propName] || {});',
];
for (var flag in featureFlags) {
lines.push('require.config.featureFlags[' + JSON.stringify(flag) + ']=' + JSON.stringify(featureFlags[flag]) + ';');
lines.push('container[' + JSON.stringify(flag) + ']=' + JSON.stringify(featureFlags[flag]) + ';');
}
//lines.push('return bundles;');
lines.push('})(require.config, \'featureFlags\');');
......@@ -451,7 +469,7 @@ module.exports = function (grunt) {
}
grunt.file.write('.grunt/holygrail/scripts/featureFlags.js', lines.join('\n'));
});
buildList.add('writeFeatureFlags');
buildList.push('writeFeatureFlags');
}
if (mpConfig.punch) {
......@@ -476,7 +494,9 @@ module.exports = function (grunt) {
//'uglify:dist');
buildList.push('copy:dist');
//'modernizr');
//buildList.push('uglify:generated'); // montyPython
if (mpConfig.uglify) {
buildList.push('uglify:generated'); // montyPython
}
if (mpConfig.useRev) {
buildList.push('rev:dist'); // montyPython
buildList.push('rev:css'); // montyPython
......@@ -488,8 +508,9 @@ module.exports = function (grunt) {
if (mpConfig.useRev) {
buildList.push('rev:requirejs');
}
//buildList.push('uglify:bower'); // montyPython
//buildList.push('uglify:requireconfig'); // montyPython
if (mpConfig.bower && mpConfig.uglify) {
buildList.push('uglify:montyPython'); // montyPython
}
buildList.push('usemin:html'); // montyPython
buildList.push('usemin:css'); // montyPython
buildList.push('htmlmin'); // montyPython
......
......@@ -25,6 +25,7 @@
"grunt-contrib-htmlmin": "~0",
"grunt-contrib-imagemin": "~0",
"grunt-contrib-requirejs": "~0",
"grunt-contrib-uglify": "~0",
"grunt-rev": "~0",
"grunt-svgmin": "~0",
"grunt-usemin": "~2",
......