Skip to content

Commit 4640614

Browse files
committed
feat($plugin-pwa): allow using local workbox files (close: #539)
1 parent 9420ca9 commit 4640614

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

packages/@vuepress/plugin-pwa/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ module.exports = (options, context) => ({
4040
await wbb.generateSW({
4141
swDest: swFilePath,
4242
globDirectory: outDir,
43-
globPatterns: ['**\/*.{js,css,html,png,jpg,jpeg,gif,svg,woff,woff2,eot,ttf,otf}']
43+
globPatterns: ['**\/*.{js,css,html,png,jpg,jpeg,gif,svg,woff,woff2,eot,ttf,otf}'],
44+
...(options.generateSWConfig || {})
4445
})
4546
await fs.writeFile(
4647
swFilePath,

packages/docs/docs/plugin/official/plugin-pwa.md

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ The `serviceWorker` option only handles the service worker. To make your site fu
4545
Also, only enable this if you are able to deploy your site with SSL, since service worker can only be registered under HTTPs URLs.
4646
:::
4747

48+
### generateSWConfig
49+
50+
- Type: `object`
51+
- Default: `{}`
52+
53+
[generateSW config](https://developers.google.com/web/tools/workbox/modules/workbox-build#full_generatesw_config) of workbox-build.
54+
55+
4856
### updatePopup
4957

5058
- Type: `boolean|object`

packages/docs/docs/zh/plugin/official/plugin-pwa.md

+8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ module.exports = {
4444
此外,只有您能够使用 SSL 部署您的站点时才能启用此功能,因为 service worker 只能在 HTTPs 的 URL 下注册。
4545
:::
4646

47+
### generateSWConfig
48+
49+
- 类型: `object`
50+
- 默认值: `{}`
51+
52+
workbox-build 的 [generateSW config](https://developers.google.com/web/tools/workbox/modules/workbox-build#full_generatesw_config)
53+
54+
4755
### updatePopup
4856

4957
- 类型: `boolean|popupConfig`

0 commit comments

Comments
 (0)