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}`) -}) diff --git a/package.json b/package.json index 39e883d18b..7fbcfb8e31 100644 --- a/package.json +++ b/package.json @@ -61,14 +61,12 @@ "coveralls": "shx cat js/coverage/lcov.info | coveralls", "docs": "npm-run-all --parallel css-docs js-docs --sequential docs-compile docs-lint", "docs-compile": "bundle exec jekyll build", - "postdocs-compile": "npm run docs-workbox-precache", "docs-production": "cross-env JEKYLL_ENV=production npm run docs-compile", "docs-lint": "npm-run-all docs-lint-*", "docs-lint-htmllint": "htmllint --rc build/.htmllintrc \"_gh_pages/**/*.html\" \"js/tests/**/*.html\"", "docs-lint-vnu-jar": "node build/vnu-jar.js", "docs-serve": "bundle exec jekyll serve", "docs-serve-only": "npm run docs-serve -- --skip-initial-build --no-watch", - "docs-workbox-precache": "node build/workbox.js", "update-deps": "ncu -a -x jquery -x bundlesize && npm update && bundle update && shx echo Manually update \"site/docs/4.1/assets/js/vendor/\"", "release": "npm run dist && npm run release-sri && npm run release-zip && npm run docs-production", "release-sri": "node build/generate-sri.js", @@ -144,8 +142,7 @@ "stylelint-order": "^1.0.0", "stylelint-scss": "^3.3.1", "uglify-js": "^3.4.9", - "vnu-jar": "18.8.29", - "workbox-build": "^3.6.2" + "vnu-jar": "18.8.29" }, "engines": { "node": ">=6" diff --git a/site/_includes/scripts.html b/site/_includes/scripts.html index 74d6f9ef2e..3db172665e 100644 --- a/site/_includes/scripts.html +++ b/site/_includes/scripts.html @@ -21,5 +21,4 @@ - {%- endif -%} diff --git a/site/docs/4.1/assets/js/src/pwa.js b/site/docs/4.1/assets/js/src/pwa.js deleted file mode 100644 index 9d2b7fbed5..0000000000 --- a/site/docs/4.1/assets/js/src/pwa.js +++ /dev/null @@ -1,21 +0,0 @@ -// NOTICE!! DO NOT USE ANY OF THIS JAVASCRIPT -// IT'S ALL JUST JUNK FOR OUR DOCS! -// ++++++++++++++++++++++++++++++++++++++++++ - -/* eslint no-console:off */ - -(function () { - 'use strict' - - if ('serviceWorker' in navigator) { - window.addEventListener('load', function () { - navigator.serviceWorker.register('/sw.js').then(function (registration) { - console.log('ServiceWorker registration successful with scope: ', registration.scope) - }).catch(function (err) { - console.log('ServiceWorker registration failed: ', err) - }) - }) - } else { - console.log('Service workers are not supported.') - } -}()) diff --git a/site/sw.js b/site/sw.js deleted file mode 100644 index bc67fee258..0000000000 --- a/site/sw.js +++ /dev/null @@ -1,5 +0,0 @@ -/* global workbox:false */ - -self.importScripts('docs/4.1/assets/js/vendor/{fileName}') - -workbox.precaching.precacheAndRoute([])