fe88d5c6 by Adam Heath

A bit of refactoring, so that there are now 4 primary phases.

There might be more phases introduced in the future.
1 parent e1ade724
......@@ -708,6 +708,24 @@ module.exports = function (grunt) {
}
});
var copyList = [];
var minifyList = [];
var revList = [];
var useList = [];
grunt.registerTask('do-copy', 'copy files', function() {
grunt.task.run(copyList);
});
grunt.registerTask('do-minify', 'minify files', function() {
grunt.task.run(minifyList);
});
grunt.registerTask('do-rev', 'rev files', function() {
if (mpConfig.useRev) {
grunt.task.run(revList);
}
});
grunt.registerTask('do-use', 'use files', function() {
grunt.task.run(useList);
});
grunt.registerTask('build', 'build the system', function() {
var buildList = [
'check',
......@@ -724,59 +742,54 @@ module.exports = function (grunt) {
if (mpConfig.punch) {
buildList.push('punch:generate');
}
useList.push('usemin:html');
buildList.push('useminPrepare'); // html
//buildList.push('usemin:views'
if (mpConfig.bower) {
buildList.push('requirejs'); // script
}
if (mpConfig.css) {
buildList.push('copy:css'); // css
copyList.push('copy:css'); // css
minifyList.push('cssmin'); // css
revList.push('rev:css'); // css
useList.push('usemin:css'); // css
}
if (mpConfig.images) {
var minify = mpConfig.images.options.minify;
if (minify === undefined || minify) {
buildList.push('imagemin'); // image
copyList.push('imagemin'); // image
} else {
buildList.push('copy:img'); // image
}
buildList.push('svgmin'); // image
if (mpConfig.useRev) {
buildList.push('rev:img'); // image
copyList.push('copy:img'); // image
}
minifyList.push('svgmin'); // image
revList.push('rev:img'); // image
}
//buildList.push('autoprefixer'); // css
if (mpConfig.punch) {
buildList.push('concat:generated'); // montyPython
copyList.push('concat:generated'); // montyPython
}
if (mpConfig.css) {
buildList.push('cssmin'); // montyPython
if (mpConfig.uglify) {
minifyList.push('uglify:generated'); // montyPython
}
copyList.push('copy:dist');
revList.push('rev:dist'); // montyPython
buildList.push('do-copy');
buildList.push('do-minify');
//'uglify:dist');
buildList.push('copy:dist');
//'modernizr');
if (mpConfig.uglify) {
buildList.push('uglify:generated'); // montyPython
}
if (mpConfig.useRev) {
buildList.push('rev:dist'); // montyPython
if (mpConfig.css) {
buildList.push('rev:css'); // montyPython
}
}
buildList.push('do-rev');
buildList.push('fixRequireConfig');
if (mpConfig.bower) {
buildList.push('concat:requirejs'); // montyPython
if (mpConfig.useRev) {
buildList.push('rev:requirejs');
}
if (mpConfig.uglify) {
buildList.push('uglify:montyPython'); // montyPython
}
}
if (mpConfig.useRev) {
buildList.push('rev:requirejs');
}
if (mpConfig.bower && mpConfig.uglify) {
buildList.push('uglify:montyPython'); // montyPython
}
buildList.push('usemin:html'); // montyPython
if (mpConfig.css) {
buildList.push('usemin:css'); // montyPython
}
buildList.push('do-use');
buildList.push('htmlmin'); // montyPython
buildList.push('deploy'); // montyPython
......