mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-09 05:16:23 +10:00
feat($plugin-pwa): allow using local workbox files (close: #539)
This commit is contained in:
@@ -40,7 +40,8 @@ module.exports = (options, context) => ({
|
||||
await wbb.generateSW({
|
||||
swDest: swFilePath,
|
||||
globDirectory: outDir,
|
||||
globPatterns: ['**\/*.{js,css,html,png,jpg,jpeg,gif,svg,woff,woff2,eot,ttf,otf}']
|
||||
globPatterns: ['**\/*.{js,css,html,png,jpg,jpeg,gif,svg,woff,woff2,eot,ttf,otf}'],
|
||||
...(options.generateSWConfig || {})
|
||||
})
|
||||
await fs.writeFile(
|
||||
swFilePath,
|
||||
|
||||
@@ -45,6 +45,14 @@ The `serviceWorker` option only handles the service worker. To make your site fu
|
||||
Also, only enable this if you are able to deploy your site with SSL, since service worker can only be registered under HTTPs URLs.
|
||||
:::
|
||||
|
||||
### generateSWConfig
|
||||
|
||||
- Type: `object`
|
||||
- Default: `{}`
|
||||
|
||||
[generateSW config](https://developers.google.com/web/tools/workbox/modules/workbox-build#full_generatesw_config) of workbox-build.
|
||||
|
||||
|
||||
### updatePopup
|
||||
|
||||
- Type: `boolean|object`
|
||||
|
||||
@@ -44,6 +44,14 @@ module.exports = {
|
||||
此外,只有您能够使用 SSL 部署您的站点时才能启用此功能,因为 service worker 只能在 HTTPs 的 URL 下注册。
|
||||
:::
|
||||
|
||||
### generateSWConfig
|
||||
|
||||
- 类型: `object`
|
||||
- 默认值: `{}`
|
||||
|
||||
workbox-build 的 [generateSW config](https://developers.google.com/web/tools/workbox/modules/workbox-build#full_generatesw_config)。
|
||||
|
||||
|
||||
### updatePopup
|
||||
|
||||
- 类型: `boolean|popupConfig`
|
||||
|
||||
Reference in New Issue
Block a user