generator-grunt-supercharged
v0.2.0
Published
A GruntJS generator for Yeoman that creates an optimised GruntJS project inspired by the HTML5rocks article 'Supercharging your Gruntfile'
Downloads
12
Readme
Grunt-Supercharged
A GruntJS generator for Yeoman that creates an optimized GruntJS project inspired by the HTML5rocks article 'Supercharging your Gruntfile'
Usage
$ yo grunt-supercharged
Optimization 1 : autoloading grunt plugins
By using the gruntjs module 'load-grunt-tasks' you don't need to manually load each task which can be cumbersome. This module will read the dependencies in your package.json and load grunt tasks that match the provided patterns.
before
grunt.loadNpmTasks('grunt-recess');
grunt.loadNpmTasks('grunt-sizediff');
grunt.loadNpmTasks('grunt-svgmin');
grunt.loadNpmTasks('grunt-styl');
grunt.loadNpmTasks('grunt-php');
...
after
require('load-grunt-tasks')(grunt);
Optimization 2 : Splitting configuration in individual files
The module load-grunt-config lets you break up your Gruntfile config by task. Every task has its own javascript file defined in the folder grunt.
folder structure
- myproject/
-- Gruntfile.js
-- grunt/
--- aliases.yaml
--- concat.js
--- uglify.js
grunt/uglify.js
module.exports = {
dist: {
files: {
'dist/js/build.min.js': ['dist/js/build.js']
}
}
};
The module requires an aliasas file (aliases.yaml) where you can register your task
grunt/aliases.yaml
default:
- 'concat'
- 'uglify'
Optimization 3 : only process modified files
The module grunt-newer builds a local cache and only execute tasks on files that changed since the last task has runned. This can speedup the build process enormously !
Simply prepend “newer:” to any of your tasks pipes
grunt/aliases.yaml
default:
- 'newer:concat'
- 'newer:uglify'
Optional modules
You can enable following handy modules through the interactive terminal.
- grunt-contrib-uglify
- grunt-contrib-watch
- grunt-contrib-clean
- grunt-contrib-sass
- grunt-contrib-jshint
- grunt-contrib-concat
- grunt-jslint
- grunt-contrib-csslint
Release notes
- 0.2.0
- added grunt-contrib-concat as optional module
- added grunt-jslint as optional module
- added grunt-contrib-csslint as optional module
- 0.1.8
- updated package versions
- grunt-contrib-uglify is now optional
- added grunt-contrib-sass as optional module
- added grunt-contrib-jshint as optional module
- 0.1.5 - initial release