Skip to content

Commit

Permalink
Merge 290438e into b2b7e40
Browse files Browse the repository at this point in the history
  • Loading branch information
renhiyama committed Aug 4, 2022
2 parents b2b7e40 + 290438e commit 248d152
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/twind/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ Used for static HTML processing (usually to provide SSR support for your javascr
3. return the HTML string with the final element classes

```js
import { setup, tw, consume, stringify } from 'twind'
import { setup, consume, stringify, tw } from 'twind'

// can be in a different file — but should be called at least once
setup({
Expand All @@ -205,15 +205,18 @@ setup({
function render() {
const html = renderApp()

// clear all styles
tw.clear()
// remember global classes
const restore = tw.snapshot()

// generated markup
const markup = comsume(html, tw)
const markup = consume(html)

// create CSS
const css = stringify(tw.target)

// restore global classes
restore()

// inject as last element into the head
return markup.replace('</head>', `<style data-twind>${css}</style></head>`)
}
Expand Down

0 comments on commit 248d152

Please sign in to comment.