Created
May 15, 2014 15:50
-
-
Save zoncoen/2c34de22166f9143aa8c to your computer and use it in GitHub Desktop.
LiveReload with gulp.
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'), | |
express = require('express'), | |
connect_livereload = require('connect-livereload'), | |
livereload = require('gulp-livereload'); | |
var EXPRESS_PORT = 4000; | |
var EXPRESS_ROOT = __dirname; | |
function startExpress() { | |
var app = express(); | |
app.use(connect_livereload()); | |
app.use(express.static(EXPRESS_ROOT)); | |
app.listen(EXPRESS_PORT); | |
} | |
gulp.task('watch', function() { | |
startExpress(); | |
var server = livereload(); | |
gulp.watch(['static/**']).on('change', function(file) { | |
server.changed(file.path); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment