Skip to content

Instantly share code, notes, and snippets.

@emgeee
Last active October 8, 2015 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emgeee/29e3f4c3674a08923c2f to your computer and use it in GitHub Desktop.
Save emgeee/29e3f4c3674a08923c2f to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
var gutil = require('gulp-util');
var livereload = require('gulp-livereload');
var watch = require('gulp-watch');
var http = require('http');
var ecstatic = require('ecstatic');
var watchGlob = 'www/**/*.{js,html,css}';
var iosDest = "platforms/ios/www/";
gulp.task('watch', function() {
// start the livereload server
livereload.listen();
watch({
glob: [ watchGlob ],
}, function(files){
files
// copy changed files
.pipe(gulp.dest(iosDest))
// trigger a livereload
.pipe(livereload());
});
});
gulp.task('server', function() {
var port = 8000;
var url = "http://localhost:" + port + "/";
http.createServer(ecstatic({
root: "platforms",
cache: 0
})).listen(port);
gutil.log(gutil.colors.blue("HTTP server listening on " + port));
});
// default - start everything
gulp.task('default', [
'server',
'watch'
]
@johannesjo
Copy link

This doesn't seem to work any more... Maybe because of gapreload?

@SebastianTroc
Copy link

@johannesjo try to change the last line from "]" to "]);"

@vwasteels
Copy link

Hello,
don't you need to run cordova prepare after each livereload() ?
and are you running cordova serve in the mean time on a different tab ?
Thanks !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment