Last active
November 16, 2015 02:59
-
-
Save kujiy/c78f0679d5d407e0ed74 to your computer and use it in GitHub Desktop.
Run your shell command whenever any file is updated.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/** | |
* | |
* Make sure you must install modules below before use. | |
* | |
* > $ npm i grunt-contrib-watch --save-dev | |
* > $ npm i grunt-exec --save-dev | |
* | |
* | |
*/ | |
module.exports = function(grunt) { | |
// Import modules from package.json's devDependencies | |
var taskName; | |
var pkg = grunt.file.readJSON('package.json'); | |
for (taskName in pkg.devDependencies) { | |
if (taskName.substring(0, 6) == 'grunt-') { | |
grunt.loadNpmTasks(taskName); | |
} | |
} | |
grunt.initConfig({ | |
watch: { | |
files: ['**/*'], | |
tasks: ['phptest'], | |
options: { | |
spawn: false, | |
}, | |
}, | |
exec: { | |
list_files: { | |
// do shell command what you want | |
command: 'ls -l', | |
stdout: true | |
} | |
} | |
}); | |
grunt.registerTask('default', ['watch']); | |
grunt.registerTask('phptest', ['exec']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment