fix gulpfile for service worker, adjustment in SW, remove comment
This commit is contained in:
parent
3cb9bd4259
commit
6d44a64193
11
gulpfile.js
11
gulpfile.js
@ -113,9 +113,7 @@ var cleanDist = function (done) {
|
|||||||
|
|
||||||
// Repeated JavaScript tasks
|
// Repeated JavaScript tasks
|
||||||
var jsTasks = lazypipe()
|
var jsTasks = lazypipe()
|
||||||
.pipe(header, banner.main, {package: package})
|
|
||||||
.pipe(optimizejs)
|
.pipe(optimizejs)
|
||||||
.pipe(dest, paths.scripts.output)
|
|
||||||
//.pipe(rename, {suffix: '.min'})
|
//.pipe(rename, {suffix: '.min'})
|
||||||
.pipe(uglify)
|
.pipe(uglify)
|
||||||
.pipe(optimizejs)
|
.pipe(optimizejs)
|
||||||
@ -241,6 +239,14 @@ var updateAssetVersion = function (done) {
|
|||||||
.pipe(hashsrc({build_dir:paths.output,src_path:"src",hash_len:"6",query_name:"v",exts:[".json"]}))
|
.pipe(hashsrc({build_dir:paths.output,src_path:"src",hash_len:"6",query_name:"v",exts:[".json"]}))
|
||||||
.pipe(dest(paths.output));
|
.pipe(dest(paths.output));
|
||||||
};
|
};
|
||||||
|
var updateSWVersion = function (done) {
|
||||||
|
return src('src/sw.js')
|
||||||
|
.pipe(hashsrc({build_dir:paths.output,src_path:"src",hash_len:"6",query_name:"v",
|
||||||
|
regex:/\s*(?:(")([^"]*)|(')([^']*))/ig,
|
||||||
|
analyze: function analyze(match){return {prefix: "'",link:match[4],suffix: ''};}
|
||||||
|
}))
|
||||||
|
.pipe(dest(paths.output));
|
||||||
|
};
|
||||||
|
|
||||||
// Watch for changes to the src directory
|
// Watch for changes to the src directory
|
||||||
var startServer = function (done) {
|
var startServer = function (done) {
|
||||||
@ -290,6 +296,7 @@ exports.default = series(
|
|||||||
),
|
),
|
||||||
buildStyles,
|
buildStyles,
|
||||||
updateAssetVersion,
|
updateAssetVersion,
|
||||||
|
updateSWVersion
|
||||||
);
|
);
|
||||||
|
|
||||||
// Watch and reload
|
// Watch and reload
|
||||||
|
@ -1,21 +1,3 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* Air Horner
|
|
||||||
* Copyright 2015 Google Inc. All rights reserved.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if (!Cache.prototype.add) {
|
if (!Cache.prototype.add) {
|
||||||
Cache.prototype.add = function add(request) {
|
Cache.prototype.add = function add(request) {
|
||||||
return this.addAll([request]);
|
return this.addAll([request]);
|
||||||
|
@ -13,7 +13,7 @@ self.addEventListener('install', function(e) {
|
|||||||
'/Samhäll',
|
'/Samhäll',
|
||||||
'/Teknik',
|
'/Teknik',
|
||||||
'/Kontakt',
|
'/Kontakt',
|
||||||
'/css/main.min.css',
|
'/css/main.css',
|
||||||
'/img/tips.jpg',
|
'/img/tips.jpg',
|
||||||
'/img/background.jpg',
|
'/img/background.jpg',
|
||||||
'/img/background85.webp',
|
'/img/background85.webp',
|
||||||
|
Reference in New Issue
Block a user