Skip to content

Instantly share code, notes, and snippets.

@superfine
Last active December 5, 2017 08:51
Show Gist options
  • Save superfine/a375fb180987c2c7515c77452d78dec7 to your computer and use it in GitHub Desktop.
Save superfine/a375fb180987c2c7515c77452d78dec7 to your computer and use it in GitHub Desktop.
Grunt build task with force options
/**
*
* Grunt build task with force options via stackoverflow
*
*/
module.exports = function(grunt) {
const previous_force_state = grunt.option('force');
grunt.registerTask('force', function(set) {
if (set === 'on') {
grunt.option('force', true);
} else if (set === 'off') {
grunt.option('force', false);
} else if (set === 'restore') {
grunt.option('force', previous_force_state);
}
});
grunt.registerTask('build', [
'force:on',
'clean:build',
'force:off',
'prettier',
'stylelint',
'sass',
'postcss',
'cssmin',
'eslint:prod',
'webpack',
'log'
]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment