From 298086a3b78ec31a1b7e346db5045df9d0d7ea08 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 10 Sep 2014 23:55:09 -0400 Subject: [PATCH] Setup task to monitor for changes --- Gruntfile.js | 10 ++++++++++ README.md | 6 ++++++ package.json | 1 + 3 files changed, 17 insertions(+) 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" } }