Skip to content

Instantly share code, notes, and snippets.

@smdahlen
Created March 18, 2013 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smdahlen/5190695 to your computer and use it in GitHub Desktop.
Save smdahlen/5190695 to your computer and use it in GitHub Desktop.
Sample Gruntfile.js
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
options: {
jshintrc: '.jshintrc',
force: true
},
node: {
options: {
node: true
},
src: ['*.js', 'lib/**/*.js']
},
browser: {
options: {
browser: true
},
src: ['app/scripts/**/*.js']
}
},
csslint: {
browser: {
options: {
import: false
},
src: ['app/styles/**/*.css']
}
},
requirejs: {
scripts: {
options: {
name: '../components/almond/almond',
include: 'main',
mainConfigFile: 'app/scripts/main.js',
out: 'public/<%= pkg.name %>-<%= pkg.version %>.min.js'
}
},
styles: {
options: {
cssIn: 'app/styles/main.css',
out: 'public/<%= pkg.name %>.css'
}
}
},
copy: {
images: {
cwd: 'app/images/',
expand: true,
src: ['**'],
dest: 'public/images/'
}
},
cssmin: {
compress: {
src: ['public/<%= pkg.name %>.css'],
dest: 'public/<%= pkg.name %>-<%= pkg.version %>.min.css'
}
},
clean: ['public'],
regarde: {
browserScripts: {
files: ['app/scripts/**/*.js'],
tasks: ['livereload', 'jshint:browser']
},
browserStyles: {
files: ['app/styles/**/*.css'],
tasks: ['livereload', 'csslint']
},
node: {
files: ['lib/**/*.js', '*.js'],
tasks: ['shell:restart', 'jshint:node']
}
},
shell: {
restart: {
command: 'sudo restart marinara'
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-livereload');
grunt.loadNpmTasks('grunt-regarde');
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('default', ['livereload-start', 'regarde']);
grunt.registerTask('lint', ['jshint', 'csslint']);
grunt.registerTask('optimize', ['clean', 'requirejs', 'copy', 'cssmin']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment