Skip to content

Instantly share code, notes, and snippets.

View JonathanPicques's full-sized avatar
🎲

Jonathan Picques JonathanPicques

🎲
View GitHub Profile
@JonathanPicques
JonathanPicques / emotion.ts
Created August 21, 2023 09:39 — forked from ValeriaVG/emotion.ts
Fresh Emotion plugin
import { Plugin, PluginRenderScripts } from "$fresh/server.ts";
import createEmotionServer from '@emotion/server/create-instance'
import { cache } from '@emotion/css'
const { extractCritical } = createEmotionServer(cache)
const main = `data:application/javascript,import hydrate from "${new URL("./main.ts", import.meta.url).href
}";export default function(state) { hydrate(state); }`;
const emotion: Plugin = {