Added offline capabilities.

This commit is contained in:
Tobias Blum
2017-02-18 22:28:42 +01:00
parent 99ff69d233
commit 51c87aab7c
5 changed files with 44 additions and 10 deletions
+10 -2
View File
@@ -18,6 +18,12 @@ gulp.task('html', function() {
.pipe(connect.reload());
});
gulp.task('appcache', function() {
gulp.src(src_dir + '*.appcache')
.pipe(gulp.dest('build'))
.pipe(connect.reload());
});
gulp.task('connect', function() {
connect.server({
@@ -29,10 +35,11 @@ gulp.task('connect', function() {
gulp.task('watch', function() {
gulp.watch(src_dir + '*.htm', ['html']);
gulp.watch(src_dir + 'js/*.js', ['html']);
gulp.watch(src_dir + '*.appcache', ['appcache']);
});
gulp.task('upload', ['html'], function() {
gulp.task('upload', ['html', 'appcache'], function() {
var url = 'http://192.168.0.40/edit';
var options = {
url: url,
@@ -49,7 +56,8 @@ gulp.task('upload', ['html'], function() {
});
var form = r.form();
form.append('data', fs.createReadStream(__dirname + "/" + build_dir + '/index.htm'), {filename: '/index.htm', contentType: "application/octet-stream"});
form.append('data', fs.createReadStream(__dirname + "/" + build_dir + '/offline.appcache'), {filename: '/offline.appcache', contentType: "application/octet-stream"});
});
gulp.task('default', ['html']);
gulp.task('default', ['html', 'appcache']);
gulp.task('serve', ['watch', 'connect']);