|
|
@ -7,6 +7,7 @@ var st = require('st') |
|
|
|
var del = require('del') |
|
|
|
var del = require('del') |
|
|
|
var swPrecache = require('sw-precache') |
|
|
|
var swPrecache = require('sw-precache') |
|
|
|
var Server = require('karma').Server |
|
|
|
var Server = require('karma').Server |
|
|
|
|
|
|
|
var manifest = require('gulp-manifest3') |
|
|
|
|
|
|
|
|
|
|
|
// The generated file is being created at src
|
|
|
|
// The generated file is being created at src
|
|
|
|
// so it can be fetched by usemin.
|
|
|
|
// so it can be fetched by usemin.
|
|
|
@ -221,7 +222,7 @@ var fileGlobs = [ |
|
|
|
'!dist/css/badbrowser.css' |
|
|
|
'!dist/css/badbrowser.css' |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
function writeServiceWorkerFile (rootDir, handleFetch, callback) { |
|
|
|
function writeServiceWorkerFile(rootDir, handleFetch, callback) { |
|
|
|
var config = { |
|
|
|
var config = { |
|
|
|
cacheId: packageJson.name, |
|
|
|
cacheId: packageJson.name, |
|
|
|
handleFetch: handleFetch, |
|
|
|
handleFetch: handleFetch, |
|
|
@ -236,13 +237,13 @@ function writeServiceWorkerFile (rootDir, handleFetch, callback) { |
|
|
|
swPrecache.write(path.join(rootDir, 'service_worker.js'), config, callback) |
|
|
|
swPrecache.write(path.join(rootDir, 'service_worker.js'), config, callback) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
gulp.task('generate-service-worker', gulp.series('build', function (callback) { |
|
|
|
/*gulp.task('generate-service-worker', gulp.series('build', function (callback) { |
|
|
|
writeServiceWorkerFile('dist', true, callback) |
|
|
|
writeServiceWorkerFile('dist', true, callback) |
|
|
|
})) |
|
|
|
}))*/ |
|
|
|
|
|
|
|
|
|
|
|
gulp.task('add-appcache-manifest', gulp.series('build', function () { |
|
|
|
gulp.task('add-appcache-manifest', gulp.series('build', function () { |
|
|
|
return gulp.src(fileGlobs) |
|
|
|
return gulp.src(fileGlobs) |
|
|
|
.pipe($.manifest({ |
|
|
|
.pipe(manifest({ |
|
|
|
timestamp: false, |
|
|
|
timestamp: false, |
|
|
|
hash: true, |
|
|
|
hash: true, |
|
|
|
network: ['http://*', 'https://*', '*'], |
|
|
|
network: ['http://*', 'https://*', '*'], |
|
|
@ -348,7 +349,9 @@ gulp.task('tdd', gulp.series('templates', 'karma-tdd')) |
|
|
|
|
|
|
|
|
|
|
|
gulp.task('package', gulp.series('cleanup-dist')) |
|
|
|
gulp.task('package', gulp.series('cleanup-dist')) |
|
|
|
|
|
|
|
|
|
|
|
gulp.task('publish', gulp.series('add-appcache-manifest', 'generate-service-worker')) |
|
|
|
gulp.task('publish', gulp.series('add-appcache-manifest', function (callback) { |
|
|
|
|
|
|
|
writeServiceWorkerFile('dist', true, callback) |
|
|
|
|
|
|
|
})) |
|
|
|
|
|
|
|
|
|
|
|
gulp.task('deploy', function () { |
|
|
|
gulp.task('deploy', function () { |
|
|
|
return gulp.src('./dist/**/*') |
|
|
|
return gulp.src('./dist/**/*') |
|
|
|