1
0
Fork 0

Setup task to monitor for changes

This commit is contained in:
Andrew Tomaka 2014-09-10 23:55:09 -04:00
parent cadce10c60
commit 298086a3b7
3 changed files with 17 additions and 0 deletions

View file

@ -1,6 +1,15 @@
module.exports = function(grunt) { module.exports = function(grunt) {
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
watch: {
scripts: {
files: ['/tmp/test/*'],
tasks: 'fixwhitespace',
options: {
spawn: false,
},
},
},
trimtrailingspaces: { trimtrailingspaces: {
main: { main: {
src: ['/tmp/test/*'], src: ['/tmp/test/*'],
@ -14,6 +23,7 @@ module.exports = function(grunt) {
}); });
grunt.loadNpmTasks('grunt-trimtrailingspaces'); grunt.loadNpmTasks('grunt-trimtrailingspaces');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', []); grunt.registerTask('default', []);
grunt.registerTask('fixwhitespace', ['trimtrailingspaces']); grunt.registerTask('fixwhitespace', ['trimtrailingspaces']);

View file

@ -5,3 +5,9 @@
grunt --gruntfile ~/grunt-test/Gruntfile.js TASK grunt --gruntfile ~/grunt-test/Gruntfile.js TASK
alias rt="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

View file

@ -10,6 +10,7 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"grunt": "^0.4.5", "grunt": "^0.4.5",
"grunt-contrib-watch": "^0.6.1",
"grunt-trimtrailingspaces": "^0.4.0" "grunt-trimtrailingspaces": "^0.4.0"
} }
} }