diff --git a/Gruntfile.js b/Gruntfile.js index 9f48cef..8032c45 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -29,6 +29,18 @@ module.exports = function (grunt) { } }, + nodemon: { + development: { + options: { + cwd: __dirname, + file: 'index.js', + env: { + NODE_ENV: 'development' + } + } + } + }, + uglify: { options: { mangle: false @@ -67,9 +79,11 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-nodemon'); grunt.registerTask('lint', ['jshint']); grunt.registerTask('compile', ['less', 'uglify']); + grunt.registerTask('start', ['nodemon:development']); grunt.registerTask('default', ['compile', 'lint']); grunt.registerTask('ci', ['compile', 'lint']); diff --git a/README.md b/README.md index 92c73b4..83381be 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,11 @@ Each of these files defines configurations for a different environment. If you'r Now that you've got your application configured, you can run in each mode with the following commands: ```sh -$ NODE_ENV=production node . -$ NODE_ENV=development ./node_modules/.bin/supervisor -q . +$ NODE_ENV=production node . # Run in production +$ NODE_ENV=development node . # Run in development ``` -Development mode runs the application with [Supervisor][supervisor], so you won't need to restart it if you change any JavaScript files. +See [development instructions](#development) for more information about running locally (and restarting automatically when files change). Configurations @@ -60,6 +60,7 @@ Now you'll be able to run the following commands: $ grunt # Run the lint and test tasks together $ grunt lint # Run JSHint with the correct config $ grunt compile # Compile front-end assets +$ grunt start # Run app in development mode, restarting if files change $ grunt watch # Watch for file changes and compile assets ``` diff --git a/package.json b/package.json index a149a86..629f821 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "grunt-contrib-less": "~0.8", "grunt-contrib-uglify": "~0.2", "grunt-contrib-watch": "~0.5", - "supervisor": "~0.5" + "grunt-nodemon": "~0.1" }, "scripts": {