Skip to content

Svelte Extractor

Supports extracting classes from class: directive.

html
<div class:text-orange-400={foo} />

Will be extracted as text-orange-400 and generates:

css
.text-orange-400 {
  color: #f6993f;
}

Installation

bash
pnpm add -D @unocss/extractor-svelte
bash
yarn add -D @unocss/extractor-svelte
bash
npm install -D @unocss/extractor-svelte
uno.config.ts
ts
import extractorSvelte from '@unocss/extractor-svelte'
import { defineConfig } from 'unocss'

export default defineConfig({
  extractors: [
    extractorSvelte(),
  ],
})

Released under the MIT License.