Skip to content

Commit

Permalink
feat: shouldPrefetch option for bundleRenderer (close: #463) (#514)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinFeng1997 authored and ulivz committed Jun 2, 2018
1 parent 3b5991f commit 9cb174d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ Also, only enable this if you are able to deploy your site with SSL, since servi

Specify locales for i18n support. For more details, see the guide on [Internationalization](../guide/i18n.md).

### shouldPrefetch

- Type: `Function`
- Default: `() => true`

A function to control what files should have `<link rel="preload">` resource hints generated. See [shouldPrefetch](https://ssr.vuejs.org/api/#shouldprefetch).

## Theming

### theme
Expand Down
7 changes: 7 additions & 0 deletions docs/zh/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ module.exports = {

提供多语言支持的语言配置。具体细节请查看 [多语言支持](../guide/i18n.md)

### shouldPrefetch

- 类型: `Function`
- 默认值: `() => true`

一个函数,用来控制对于哪些文件,是需要生成 `<link rel="prefetch">` 资源提示的。请参考 [shouldPrefetch](https://ssr.vuejs.org/zh/api/#shouldpreload)

## 主题

### theme
Expand Down
1 change: 1 addition & 0 deletions lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module.exports = async function build (sourceDir, cliOptions = {}) {
clientManifest,
runInNewContext: false,
inject: false,
shouldPrefetch: options.siteConfig.shouldPrefetch || (() => true),
template: await fs.readFile(path.resolve(__dirname, 'app/index.ssr.html'), 'utf-8')
})

Expand Down

0 comments on commit 9cb174d

Please sign in to comment.