Last active
October 8, 2015 14:31
-
-
Save emgeee/29e3f4c3674a08923c2f 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'); | |
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 try to change the last line from "]" to "]);"
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
This doesn't seem to work any more... Maybe because of gapreload?