rsnext/examples/with-emotion-vanilla/shared/renderer.js
MMT-LD 60b0267400
feature/vanilla-emotion - add an example of vanilla emotion (#20228)
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-01-22 12:16:50 +01:00

12 lines
389 B
JavaScript

import createEmotionServer from '@emotion/server/create-instance'
import { cache } from '@emotion/css'
export const renderStatic = async (html) => {
if (html === undefined) {
throw new Error('did you forget to return html from renderToString?')
}
const { extractCritical } = createEmotionServer(cache)
const { ids, css } = extractCritical(html)
return { html, ids, css }
}