[UnoCSS](https://github.com/antfu/unocss) plugin for [HTMelt](https://github.com/alloc/htmelt).
npm install @htmelt/plugin1. It loads your unocss.config.js file.
2. It scans your JSX and TSX files for tokens identified by UnoCSS
plugins/presets.
3. For each JSX and TSX module, it generates a separate CSS file and
adds it to the document with JavaScript.
- [ ] Use lightningcss to remove duplicate CSS rules on a per-chunk basis.
``sh`
pnpm install -D @htmelt/unocss
yarn add -D @htmelt/unocss
npm install --save-dev @htmelt/unocss
extensionsThe typings of import.meta and import.meta.env can both be extended
by plugins.
`ts
declare module '@htmelt/plugin/dist/importMeta.mjs' {
export interface ImportMeta {
foo: string
}
export interface ImportMetaEnv {
bar: string
}
}
// Important: Ensure this file is a module
export {}
`
It's recommended to add a client.d.ts module to your plugin's rootmy-plugin/client
directory and advise users to include in the typeshtmelt/client
array of their tsconfig (along with ).
`json``
{
"compilerOptions": {
"types": ["htmelt/client", "my-plugin/client"]
}
}