Add fix for gulp 4
Signed-off-by: r4sas <r4sas@i2pmail.org> Fix from https://github.com/zhukov/webogram/issues/1863#issuecomment-507324801
This commit is contained in:
parent
8fcdf7df12
commit
b237792585
13
gulpfile.js
13
gulpfile.js
@ -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/**/*')
|
||||||
|
13529
package-lock.json
generated
13529
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -54,7 +54,7 @@
|
|||||||
"gulp-less": "^4.0.1",
|
"gulp-less": "^4.0.1",
|
||||||
"gulp-livereload": "^4.0.1",
|
"gulp-livereload": "^4.0.1",
|
||||||
"gulp-load-plugins": "^1.5.0",
|
"gulp-load-plugins": "^1.5.0",
|
||||||
"gulp-manifest": "0.1.1",
|
"gulp-manifest3": "^0.1.2",
|
||||||
"gulp-minify-css": "^0.3.12",
|
"gulp-minify-css": "^0.3.12",
|
||||||
"gulp-minify-html": "^0.1.1",
|
"gulp-minify-html": "^0.1.1",
|
||||||
"gulp-ng-annotate": "~0.5.2",
|
"gulp-ng-annotate": "~0.5.2",
|
||||||
@ -83,4 +83,4 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user