Commit a23dc51
authored
server: Store mount selector and return
* Store mount selector and return `this`
This allows `.mount('body')` to be used on the server like so:
```js
module.exports = app.mount('body')
```
Then, when server rendering you can do:
```js
var app = require('./app')
fillServerTemplate(html, app.selector, app.toString('/'))
```
Where `fillServerTemplate` is a function that replaces the HTML at a
CSS selector with some string.
This way you do not need to check for `typeof window` in your
application entry point to do server rendering, and it allows tools like
bankai to automatically inline server rendered html in the correct place.
* docs
* better wordsthis (#625)1 parent 658a399 commit a23dc51
2 files changed
+16
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
462 | | - | |
| 462 | + | |
463 | 463 | | |
464 | 464 | | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
465 | 474 | | |
466 | 475 | | |
467 | 476 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
157 | 162 | | |
158 | 163 | | |
159 | 164 | | |
| |||
0 commit comments