diff --git a/circle.yml b/circle.yml index bf961fe9..18371cbd 100644 --- a/circle.yml +++ b/circle.yml @@ -9,4 +9,6 @@ general: test: override: - - npm run test:cover # only run unit tets for now before we setup SauceLabs + - npm run lint + - npm run test:cover # only run unit tests in Phantom for now before we setup SauceLabs + - npm run test:ssr diff --git a/src/entries/web-server-renderer.js b/src/entries/web-server-renderer.js index f9773b65..e6dc2ff5 100644 --- a/src/entries/web-server-renderer.js +++ b/src/entries/web-server-renderer.js @@ -5,14 +5,23 @@ import style from 'web/server/modules/style' import show from 'web/server/directives/show' import { isUnaryTag } from 'web/util/index' -export default createRenderer({ - isUnaryTag, - modules: [ - attrs, - klass, - style - ], - directives: { - show - } -}) +const modules = [ + attrs, + klass, + style +] + +const baseDirectives = { + show +} + +export default function publicCreateRenderer (options = {}) { + // user can provide server-side implementations for custom directives + // when creating the renderer. + const directives = Object.assign(baseDirectives, options.directives) + return createRenderer({ + isUnaryTag, + modules, + directives + }) +} diff --git a/test/ssr/ssr.stream.spec.js b/test/ssr/ssr.stream.spec.js index 27abb302..d261cbb0 100644 --- a/test/ssr/ssr.stream.spec.js +++ b/test/ssr/ssr.stream.spec.js @@ -1,6 +1,7 @@ import Vue from '../../dist/vue.common.js' import { compileToFunctions } from '../../dist/compiler.common.js' -import { renderToStream } from '../../dist/server-renderer.js' +import createRenderer from '../../dist/server-renderer.js' +const { renderToStream } = createRenderer() describe('SSR: renderToStream', () => { it('should render to a stream', done => { diff --git a/test/ssr/ssr.sync.spec.js b/test/ssr/ssr.sync.spec.js index 248b8e19..f29a2b50 100644 --- a/test/ssr/ssr.sync.spec.js +++ b/test/ssr/ssr.sync.spec.js @@ -1,6 +1,9 @@ import Vue from '../../dist/vue.common.js' import { compileToFunctions } from '../../dist/compiler.common.js' -import { renderToString } from '../../dist/server-renderer.js' +import createRenderer from '../../dist/server-renderer.js' +const { renderToString } = createRenderer() + +// TODO: test custom server-side directives describe('SSR: renderToString', () => { it('static attributes', () => {