module.exports = function(grunt) { // 1. All configuration goes here grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), express: { options: { // Override the command used to start the server. // (do not use 'coffee' here, the server will not be able to restart // see below at opts for coffee-script support) cmd: process.argv[0], // Will turn into: `node OPT1 OPT2 ... OPTN path/to/server.js ARG1 ARG2 ... ARGN` // (e.g. opts: ['node_modules/coffee-script/bin/coffee'] will correctly parse coffee-script) opts: [ ], args: [ ], // Setting to `false` will effectively just run `node path/to/server.js` background: true, // Called when the spawned server throws errors fallback: function() {}, // Override node env's PORT // port: 3000, // Override node env's NODE_ENV // node_env: undefined, // Consider the server to be "running" after an explicit delay (in milliseconds) // (e.g. when server has no initial output) delay: 0, // Regular expression that matches server output to indicate it is "running" output: ".+", // Set --debug (true | false | integer from 1024 to 65535, has precedence over breakOnFirstLine) debug: false, // Set --debug-brk (true | false | integer from 1024 to 65535) breakOnFirstLine: false, // Object with properties `out` and `err` both will take a path to a log file and // append the output of the server. Make sure the folders exist. logs: undefined }, dev: { options: { script: 'bin/app.js' } }, // prod: { // options: { // script: 'path/to/prod/server.js', // node_env: 'production' // } // }, // test: { // options: { // script: 'path/to/test/server.js' // } // } }, watch: { options: { livereload: true }, webserver: { files: [ 'bin/app.js', 'config/*' ], tasks: [ 'express:dev' ], options: { spawn: false } }, // less: { // files: ["public/**/*.less"], // tasks: ["less"], // options: { // livereload: false // } // }, public: { files: ["public/**/*.css", "public/**/*.js"] } } }); // 3. Where we tell Grunt we plan to use this plug-in. grunt.loadNpmTasks('grunt-express-server'); grunt.loadNpmTasks('grunt-contrib-watch'); // 4. Where we tell Grunt what to do when we type "grunt" into the terminal. grunt.registerTask('default', ['express','watch']); };