Skip to content

Commit

Permalink
feat($plugin-pwa): allow using local workbox files (close: #539)
Browse files Browse the repository at this point in the history
  • Loading branch information
ulivz committed Apr 6, 2019
1 parent 9420ca9 commit 4640614
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/@vuepress/plugin-pwa/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 8 additions & 0 deletions packages/docs/docs/plugin/official/plugin-pwa.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
8 changes: 8 additions & 0 deletions packages/docs/docs/zh/plugin/official/plugin-pwa.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit 4640614

Please sign in to comment.