Skip to content

Instantly share code, notes, and snippets.

@spearwolf
Created September 16, 2013 09:00
Show Gist options
  • Select an option

  • Save spearwolf/6578223 to your computer and use it in GitHub Desktop.

Select an option

Save spearwolf/6578223 to your computer and use it in GitHub Desktop.
Gruntfile.js for developing node.js apps with watch and optional coffeescript ..
module.exports = function(grunt) {
grunt.initConfig({
watch: {
coffee: {
files: [
'*.coffee',
'app/**/*.coffee',
'routes/**/*.coffee',
'lib/**/*.coffee'
],
tasks: ['coffee', 'develop']
},
js: {
files: [
'app.js',
'app/**/*.js',
'routes/**/*.js'
],
tasks: ['develop'],
options: { nospawn: true }
}
},
coffee: {
compile: {
expand: true,
cwd: '.',
src: ['*.coffee', 'app/**/*.coffee'],
ext: '.js'
}
},
develop: {
server: {
file: 'app.js',
//args: ['appArg1', 'appArg2'],
nodeArgs: ['--harmony', '--parallel_recompilation'],
env: { NODE_ENV: 'development' }
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-develop');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.registerTask('default', ['develop', 'watch']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment