import { extract } from "https://deno.land/x/fresh@1.6.3/plugins/twindv1_deps.ts";
Used for static HTML processing (usually to provide SSR support for your javascript-powered web apps)
Note: Consider using inline instead.
- parse the markup and process element classes with the provided Twind instance
- update the class attributes if necessary
- return the HTML string with the final element classes
import { extract } from '@twind/core'
function render() {
const { html, css } = extract(renderApp())
// inject as last element into the head
return html.replace('</head>', `<style data-twind>${css}</style></head>`)
}
You can provide your own Twind instance:
import { extract } from '@twind/core'
import { tw } from './custom/twind/instance'
function render() {
const { html, css } = extract(renderApp(), tw)
// inject as last element into the head
return html.replace('</head>', `<style data-twind>${css}</style></head>`)
}
Returns
the possibly modified html and css