1.0.0-next.14 • Published 2 years ago

@twind/sveltekit v1.0.0-next.14

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@twind/sveltekit


READ THIS FIRST!

Twind v1 is still in beta. Expect bugs!


Seamless integration of twind for SvelteKit

Used within the following examples:

Installation

Install from npm:

npm install twind @twind/sveltekit@next

Usage

Please see examples/sveltekit for detailed usage example.

src/routes/__layout.svelte

<script type="module">
  import { setup } from 'twind'
  // import { setup } from '@twind/tailwind'

  import twindConfig from '../twind.config'

  setup(twindConfig)
</script>

src/hooksSvelteKit › Hooks

enable for server-side rendering of Twind styles

import { withTwind } from '@twind/sveltekit'

export const handle = withTwind()

If your have other handles use the sequence helper:

import { sequence } from '@sveltejs/kit/hooks'

export const handle = sequence(withTwind(), ...otherHandles)

Using a custom Twind instance:

import { withTwind } from '@twind/sveltekit'
import { tw } from './custom/twind/instance'

export const handle = withTwind(tw)

API

withTwind([tw])

TBD