https://github.com/baidu/san-ssr
San SSR framework and utils
https://github.com/baidu/san-ssr
san ssr ssr-target-js
Last synced: 12 months ago
JSON representation
San SSR framework and utils
- Host: GitHub
- URL: https://github.com/baidu/san-ssr
- Owner: baidu
- Created: 2019-09-02T05:10:20.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-05T13:38:32.000Z (about 2 years ago)
- Last Synced: 2025-06-21T19:40:52.096Z (about 1 year ago)
- Topics: san, ssr, ssr-target-js
- Language: TypeScript
- Homepage: https://baidu.github.io/san-ssr/
- Size: 8.77 MB
- Stars: 39
- Watchers: 7
- Forks: 22
- Open Issues: 12
-
Metadata Files:
- Readme: README.en.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# San SSR
[](https://www.npmjs.org/package/san-ssr)
[](https://www.npmjs.org/package/san-ssr)
[](https://github.com/baidu/san-ssr/actions?query=workflow:Check)
[](https://coveralls.io/github/baidu/san-ssr?branch=master)
[](https://github.com/baidu/san-ssr)
[](https://github.com/baidu/san-ssr/issues)
[](https://david-dm.org/baidu/san-ssr)
[](https://david-dm.org/baidu/san-ssr?type=dev)
[](https://github.com/baidu/san-ssr/blob/master/LICENSE)
[](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits)
**The purpurse of this repo** is to provide an SSR framework and utils for the [san][san] components.
* [中文](https://github.com/baidu/san-ssr/blob/master/README.md)
* SSR migration:[from san to san-ssr](https://github.com/baidu/san-ssr/wiki/%E4%BB%8E-san-%E8%BF%81%E7%A7%BB%E5%88%B0-san-ssr)
* Demo:[demo/](https://github.com/baidu/san-ssr/tree/master/demo)
## Usage
The [SanProject class][sanproject] is used to compile component files into ssr render function.
```javascript
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][sanproject] for details, or refer to the demo project in /demo directory.
## Working with San
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](https://github.com/baidu/san/issues/441#issuecomment-550260372), a minor version in san implies possible BREAKING CHANGES, thus the peerDependency is specified via [tilde version](https://docs.npmjs.com/misc/semver#tilde-ranges-123-12-1).
## Other Target Platforms
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:
* [san-ssr-target-js](https://github.com/baidu/san-ssr/tree/master/src/target-js)
* [san-ssr-target-php](https://github.com/baidu/san-ssr-target-php)
[san]: https://github.com/baidu/san
[sanproject]: https://baidu.github.io/san-ssr/classes/_src_models_san_project_.sanproject.html
[target-compile]: https://baidu.github.io/san-ssr/interfaces/_models_compiler_.compiler.html#compile