Created
June 2, 2015 08:12
-
-
Save youweit/aa428b27143e2d83018a to your computer and use it in GitHub Desktop.
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'), | |
path = require('path'), | |
EXPRESS_ROOT = path.join(__dirname, 'app'); | |
var startExpress = function() { | |
var server = require('./server.js'); | |
server({ | |
dir:EXPRESS_ROOT, | |
port: 9898 | |
}); | |
} | |
var startLiveReload = function() { | |
var lr = require('tiny-lr')(); | |
lr.listen(35729); | |
return lr; | |
} | |
var notifyLivereload = function(event, lr) { | |
var fileName = require('path').relative(EXPRESS_ROOT, event.path); | |
lr.changed({ | |
body: { | |
files: [fileName] | |
} | |
}); | |
} | |
// `gulp.task()` defines task that can be run calling `gulp xyz` from the command line | |
// The `default` task gets called when no task name is provided to Gulp | |
gulp.task('default', function () { | |
startExpress(); | |
var lr = startLiveReload(); | |
gulp.watch('app/**', function(event){ | |
notifyLivereload(event, lr); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment