FILE="~/Downloads/node-v0.10.20-linux-x64.tar.gz"
sudo tar -xzf $FILE -C /opt/ sudo su cd /usr/local/bin ln -s /opt/node-v0.10.20-linux-x64/bin/node node # possibly add js, nodejs as aliases ln -s /opt/node-v0.10.20-linux-x64/bin/npm npm
-
create minimal package.json (see npm docs), if not yet existing
-
local install grunt & plugins you want:
npm install grunt grunt-contrib-jshint grunt-contrib-watch --save-dev
-
create and edit Gruntfile.js. example:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
def: ['src/js/main.js', 'src/js/presets.js'] // note: wildcards possible here
},
watch: {
files: ['src/js/**'],
tasks: ['jshint']
}
});
grunt.loadNpmTasks('grunt-contrib-jshint'); // load plugin
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['jshint']); // set magic default tasks
};
- run grunt whenever you want with either
grunt
grunt jshint
grunt watch