diff --git a/Gruntfile.js b/Gruntfile.js index b987b34..8d66413 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,6 +1,15 @@ module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), + watch: { + scripts: { + files: ['/tmp/test/*'], + tasks: 'fixwhitespace', + options: { + spawn: false, + }, + }, + }, trimtrailingspaces: { main: { src: ['/tmp/test/*'], @@ -14,6 +23,7 @@ module.exports = function(grunt) { }); grunt.loadNpmTasks('grunt-trimtrailingspaces'); + grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default', []); grunt.registerTask('fixwhitespace', ['trimtrailingspaces']); diff --git a/README.md b/README.md index 09a9233..e6ab934 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,9 @@ grunt --gruntfile ~/grunt-test/Gruntfile.js TASK alias rt="grunt --gruntfile ~/grunt-test/Gruntfile.js TASK" + +## Tasks + +* fixwhitespace - Removes trailing whitespace from files in /tmp/test +* watch - Watches /tmp/test for any changes and will run fixwhitespace if any + occur diff --git a/package.json b/package.json index abda37b..19b6ab9 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "license": "MIT", "dependencies": { "grunt": "^0.4.5", + "grunt-contrib-watch": "^0.6.1", "grunt-trimtrailingspaces": "^0.4.0" } }