diff options
author | Mark Otto <markdotto@gmail.com> | 2018-07-25 03:48:18 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2018-10-20 16:00:28 +0300 |
commit | 5bf37eba532aae1ec9decdc81b7ae6bb8b7e37a4 (patch) | |
tree | 6997c3ed175154106e39be1dfefe32fd14a7f43a /build | |
parent | b1dc6b324c33bc6a4b0cb2dc06939136e32d0e0c (diff) |
Remove service worker
Diffstat (limited to 'build')
-rw-r--r-- | build/workbox.config.json | 8 | ||||
-rw-r--r-- | build/workbox.js | 56 |
2 files changed, 0 insertions, 64 deletions
diff --git a/build/workbox.config.json b/build/workbox.config.json deleted file mode 100644 index a649431ed7..0000000000 --- a/build/workbox.config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "globDirectory": "./", - "globPatterns": [ - "_gh_pages/**/*.{html,css,js,json,png,svg}" - ], - "swSrc": "./site/sw.js", - "swDest": "./_gh_pages/sw.js" -} diff --git a/build/workbox.js b/build/workbox.js deleted file mode 100644 index a8d9551585..0000000000 --- a/build/workbox.js +++ /dev/null @@ -1,56 +0,0 @@ -/*! - * Script to generate our docs service worker. - * Copyright 2017-2018 The Bootstrap Authors - * Copyright 2017-2018 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ - -const fs = require('fs') -const path = require('path') -const swBuild = require('workbox-build') -const config = require('./workbox.config.json') - -const buildPrefix = '_gh_pages/' - -const workboxSWSrcPath = require.resolve('workbox-sw') -const wbFileName = path.basename(workboxSWSrcPath) -const workboxSWDestPath = `${buildPrefix}docs/4.1/assets/js/vendor/${wbFileName}` -const workboxSWSrcMapPath = `${workboxSWSrcPath}.map` -const workboxSWDestMapPath = `${workboxSWDestPath}.map` - -fs.createReadStream(workboxSWSrcPath).pipe(fs.createWriteStream(workboxSWDestPath)) -fs.createReadStream(workboxSWSrcMapPath).pipe(fs.createWriteStream(workboxSWDestMapPath)) - -const updateUrl = (manifestEntries) => { - const manifest = manifestEntries.map((entry) => { - if (entry.url.startsWith(buildPrefix)) { - const regex = new RegExp(buildPrefix, 'g') - entry.url = entry.url.replace(regex, '') - } - return entry - }) - return { - manifest, - warnings: [] - } -} - -config.manifestTransforms = [updateUrl] - -swBuild.injectManifest(config).then(({ - count, - size -}) => { - const wbSwRegex = /{fileName}/g - fs.readFile(config.swDest, 'utf8', (err, data) => { - if (err) { - throw err - } - const swFileContents = data.replace(wbSwRegex, wbFileName) - fs.writeFile(config.swDest, swFileContents, () => { - console.log(`Pre-cache Manifest generated. Pre-cached ${count} files, totalling ${size} bytes.`) - }) - }) -}).catch((error) => { - console.error(`Something went wrong: ${error}`) -}) |