Grunt - the javascript task runner
Install grunt
Requirements: npm and git should be installed first.
npm install -g grunt-cli
npm init
npm install grunt --save-dev
npm install grunt-contrib-uglify --save-dev
Your package.json
should be something like this:
{
"name": "example",
"version": "0.0.0",
"devDependencies": {
"grunt": "x",
"grunt-contrib-uglify": "x"
}
}
Gruntfile.js
module.exports = function (grunt) {
grunt.initConfig({
uglify: {
build: {
files: {
'dist/scripts.js': ['components/jquery/jquery.js', 'components/bootstrap/docs/assets/js/bootstrap.js']
}
}
}
})
grunt.loadNpmTasks('grunt-contrib-uglify')
grunt.registerTask('default', ['uglify'])
}
Now you can run grunt default task just typing grunt
in console.
There is more contributed plugins like:
Stylesheet preprocessors
https://npmjs.org/package/grunt-contrib-compass https://npmjs.org/package/grunt-contrib-less
Minifiers
https://npmjs.org/package/grunt-contrib-uglify https://npmjs.org/package/grunt-contrib-mincss https://npmjs.org/package/grunt-contrib-htmlmin
Linters
https://npmjs.org/package/grunt-contrib-csslint https://npmjs.org/package/grunt-contrib-jshint
Testing
https://npmjs.org/package/grunt-contrib-nodeunit https://npmjs.org/package/grunt-contrib-qunit https://npmjs.org/package/grunt-contrib-jasmine
Images
https://npmjs.org/package/grunt-image-resize https://npmjs.org/package/grunt-contrib-imagemin
And others
https://npmjs.org/package/grunt-manifest https://npmjs.org/package/grunt-contrib-coffee https://npmjs.org/package/grunt-contrib-concat https://npmjs.org/package/grunt-contrib-clean https://npmjs.org/package/grunt-contrib-jade