The purpurse of this repo is to provide an SSR framework and utils for the san components.
- 中文
- SSR migration:from san to san-ssr
- Demo:demo/
The SanProject class is used to compile component files into ssr render function.
const { SanProject } = require('san-ssr')
const app = require('src/component.js')
const project = new SanProject()
const render = project.compileToRenderer(app)
console.log(render({name: 'harttle'}))
See API doc SanProject for details, or refer to the demo project in /demo directory.
Supported san versions for each release are specified by peerDependencies
, that means you'll need both san
and san-ssr
installed in case you need server side rendering. And it's considered compatible as long as you don't see any UNMET
warning.
Note: As described in baidu/san/issues/441, a minor version in san implies possible BREAKING CHANGES, thus the peerDependency is specified via tilde version.
san-ssr provides static analysis for San components and generates abstract component tree, while code generation is a separated process, which is provided by specific implementations: