Created
June 18, 2015 20:57
-
-
Save melihovv/e6f447400f689fbf639f to your computer and use it in GitHub Desktop.
Gulpfile to reload server and browser during development.
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
var gulp = require('gulp'); | |
var nodemon = require('gulp-nodemon'); | |
var livereload = require('gulp-livereload'); | |
gulp.task('default', function () { | |
livereload.listen(); | |
nodemon({ | |
// Main script. | |
script: 'app.js', | |
// File extensions to watch. | |
ext: 'js hbs', | |
// Directories to watch. | |
watch: [ | |
'models', | |
'controllers', | |
'views', | |
'.' | |
], | |
// Don't output to console. | |
// Output is in the next method. | |
stdout: false | |
}).on('readable', function () { | |
this.stdout.on('data', function (chunk) { | |
// If stream contain 'listening'... | |
if (/listening/.test(chunk.toString())) { | |
// Reload page. | |
livereload.reload() | |
} | |
// Make output to console. | |
process.stdout.write(chunk) | |
}) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment