2019-04-20 12:02:51 +00:00
|
|
|
export default class BaseRenderer {
|
2019-07-10 10:45:49 +00:00
|
|
|
constructor (serverContext) {
|
2019-04-20 12:02:51 +00:00
|
|
|
this.serverContext = serverContext
|
|
|
|
this.options = serverContext.options
|
|
|
|
|
|
|
|
this.vueRenderer = this.createRenderer()
|
|
|
|
}
|
|
|
|
|
2019-07-10 10:45:49 +00:00
|
|
|
createRenderer () {
|
2019-04-20 12:02:51 +00:00
|
|
|
throw new Error('`createRenderer()` needs to be implemented')
|
|
|
|
}
|
|
|
|
|
2019-07-10 10:45:49 +00:00
|
|
|
renderTemplate (templateFn, opts) {
|
2019-04-20 12:02:51 +00:00
|
|
|
// Fix problem with HTMLPlugin's minify option (#3392)
|
|
|
|
opts.html_attrs = opts.HTML_ATTRS
|
|
|
|
opts.head_attrs = opts.HEAD_ATTRS
|
|
|
|
opts.body_attrs = opts.BODY_ATTRS
|
|
|
|
|
|
|
|
return templateFn(opts)
|
|
|
|
}
|
|
|
|
|
2019-07-10 10:45:49 +00:00
|
|
|
render () {
|
2019-04-20 12:02:51 +00:00
|
|
|
throw new Error('`render()` needs to be implemented')
|
|
|
|
}
|
|
|
|
}
|