renderLinks -> renderResourceHints

This commit is contained in:
Evan You 2017-04-21 17:46:49 +08:00
parent e5814dee67
commit 4f9f28cf16
3 changed files with 6 additions and 6 deletions

View File

@ -65,7 +65,7 @@ export default class TemplateRenderer {
bindRenderFns (context: Object) {
const renderer: any = this
;['Links', 'State', 'Scripts', 'Styles'].forEach(type => {
;['ResourceHints', 'State', 'Scripts', 'Styles'].forEach(type => {
context[`render${type}`] = renderer[`render${type}`].bind(renderer, context)
})
}
@ -81,7 +81,7 @@ export default class TemplateRenderer {
return (
template.head(context) +
(context.head || '') +
this.renderLinks(context) +
this.renderResourceHints(context) +
this.renderStyles(context) +
template.neck(context) +
content +
@ -104,7 +104,7 @@ export default class TemplateRenderer {
return context.styles || ''
}
renderLinks (context: Object): string {
renderResourceHints (context: Object): string {
return this.renderPreloadLinks(context) + this.renderPrefetchLinks(context)
}

View File

@ -44,7 +44,7 @@ export default class TemplateStream extends Transform {
}
// inline preload/prefetch directives for initial/async chunks
const links = this.renderer.renderLinks(this.context)
const links = this.renderer.renderResourceHints(this.context)
if (links) {
this.push(links)
}

View File

@ -278,7 +278,7 @@ describe('SSR: template option', () => {
createRendererWithManifest('split.js', {
runInNewContext,
template: `<html>` +
`<head>{{{ renderLinks() }}}</head>` +
`<head>{{{ renderResourceHints() }}}</head>` +
`<body><!--vue-ssr-outlet-->{{{ renderScripts() }}}</body>` +
`</html>`,
inject: false
@ -303,7 +303,7 @@ describe('SSR: template option', () => {
const customOutput =
`<html><head>${
context.renderLinks()
context.renderResourceHints()
}</head><body>${
res +
context.renderScripts()