Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

extract

Used for static HTML processing (usually to provide SSR support for your javascript-powered web apps)

Note: Consider using inline instead.

  1. parse the markup and process element classes with the provided Twind instance
  2. update the class attributes if necessary
  3. 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>`)
}
function extract(html: string, tw?: Twind<any, any>): ExtractResult;
§
extract(html: string, tw?: Twind<any, any>): ExtractResult
[src]

§Parameters

§
html: string
[src]
§
tw?: Twind<any, any> optional
[src]

a Twind instance (default: twind managed tw)

§Return Type

§

the possibly modified html and css