diff --git a/gulpfile.js b/gulpfile.js index 8902f44..34e3476 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -35,9 +35,12 @@ const translates = [ // TEMPLATES const tmplTasks = translates.map(({ dest, url }) => { return (done) => { - gulp.src(`./src/index-src.html`) + gulp.src([ + './src/index.html', + './src/manifest.json', + './src/pwabuilder-sw.js' + ]) .pipe(mustache(url)) - .pipe(rename(`index.html`)) .pipe(gulp.dest(dest)) .pipe(reload({ stream: true })); done(); diff --git a/src/index-src.html b/src/index.html similarity index 95% rename from src/index-src.html rename to src/index.html index c41c805..433ba11 100644 --- a/src/index-src.html +++ b/src/index.html @@ -1,6 +1,7 @@ {{title}} + @@ -144,7 +145,12 @@

{{preview}}:

- + diff --git a/src/manifest.json b/src/manifest.json new file mode 100644 index 0000000..9824772 --- /dev/null +++ b/src/manifest.json @@ -0,0 +1,13 @@ +{ + "dir": "auto", + "display": "browser", + "name": "URL-encoder for SVG", + "short_name": "URL-encoder for SVG", + "scope": "/url-encoder/", + "lang": "ru", + "description": "URL-encoder for SVG", + "theme_color": "none", + "background_color": "none", + "дисплей": "browser", + "цвет_темы": "none" +} \ No newline at end of file diff --git a/src/pwabuilder-sw.js b/src/pwabuilder-sw.js new file mode 100644 index 0000000..3f11d26 --- /dev/null +++ b/src/pwabuilder-sw.js @@ -0,0 +1,18 @@ +// This is the "Offline copy of assets" service worker + +const CACHE = "pwabuilder-offline"; + +importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js'); + +self.addEventListener("message", (event) => { + if (event.data && event.data.type === "SKIP_WAITING") { + self.skipWaiting(); + } +}); + +workbox.routing.registerRoute( + new RegExp('/*'), + new workbox.strategies.StaleWhileRevalidate({ + cacheName: CACHE + }) +); \ No newline at end of file