Skip to content

Instantly share code, notes, and snippets.

@georgicodes
Created May 12, 2014 23:44
Show Gist options
  • Select an option

  • Save georgicodes/2d3fe734c98cd1197e4a to your computer and use it in GitHub Desktop.

Select an option

Save georgicodes/2d3fe734c98cd1197e4a to your computer and use it in GitHub Desktop.
A simple Gruntfile which watches a directory for changes to coffeescript files, compiles them and also runs coffeelint. An additional MochaTest tasks runs independently.
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
coffee: {
files:['src/**/*.coffee'],
tasks: ['coffee:compileAll', 'coffeelint:app'],
options: {
spawn: false
}
}
},
coffee: {
compileAll: {
expand: true,
bare: true,
cwd: 'src',
src: '**/*.coffee',
dest: 'lib',
ext: '.js'
}
},
coffeelint: {
app: ['src/**/*.coffee']
},
mochaTest: {
test: {
options: {
reporter: 'spec',
require: 'coffee-script/register'
},
src: ['test/**/*.coffee']
}
}
});
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-coffeelint');
grunt.loadNpmTasks('grunt-mocha-test');
// Default task(s).
grunt.registerTask('default', ['coffee', 'watch', 'coffeelint', 'mochaTest']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment