Created
June 3, 2015 17:20
-
-
Save vedovelli/82ebe75f169e009a318d to your computer and use it in GitHub Desktop.
Gulpfile.js para rodar duo() sempre que o javascript especificado for salvo.
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
/** | |
* gulpfile para automatizar a compilação feita com o Duo.js. | |
* Author: Fabio Vedovelli <[email protected]> | |
* http://vedovelli.com.br/ | |
* Inspirado em https://github.com/mozilla/galaxy.js/blob/master/gulpfile.js | |
*/ | |
var gulp = require('gulp'); | |
/** | |
* Vai rodar o dup <nome arquivo>.js como se fosse no Terminal | |
*/ | |
var exec = require('child_process').exec; | |
/** | |
* Arquivo a ser observado. -- Mude para a localização do seu arquivo -- | |
*/ | |
var jsFile = './src/home.js'; | |
/** | |
* Basta no seu terminal rodar `gulp` (sem os apóstrofes, claaaaro) | |
*/ | |
gulp.task('default', ['run_duo', 'watch']); | |
/** | |
* Responsável por rodar `dup <nome arquivo>.js` | |
*/ | |
gulp.task('run_duo', function() | |
{ | |
exec('duo ' + jsFile, function (err, stdout, stderr) | |
{ | |
console.log(err); | |
console.log(stdout); | |
console.log(stderr); | |
}); | |
}); | |
gulp.task('watch', function() | |
{ | |
/** | |
* Quando o arquivo for modificado, rodar task run_duo | |
*/ | |
gulp.watch(jsFile, ['run_duo']); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment