unplugin-unocss-config
v0.1.0
Published
Use uno config in run-time
Downloads
6
Readme
unplugin-unocss-config
Use uno config in run-time.
Usage
<script lang='ts' setup>
console.log(__UNO__)
console.log(__UNO_CONFIG__)
console.log(__UNO_THEME__)
console.log(import.meta.env.__UNO__)
console.log(import.meta.env.__UNO_CONFIG__)
console.log(import.meta.env.__UNO_THEME__)
const presets = __UNO_CONFIG__.presets?.map((p: any) => p.name)
const transformers = import.meta.env.__UNO_CONFIG__.transformers?.map((t: any) => t.name)
</script>
Install
pnpm add unplugin-unocss-config
// vite.config.ts
import UnoCSSConfig from 'unplugin-unocss-config/vite'
export default defineConfig({
plugins: [
UnoCSSConfig(),
],
})
Type
// vite-env.d.ts
/// <reference types="unplugin-unocss-config/client" />
Example: playground/
// nuxt.config.js
export default {
buildModules: [
['unplugin-unocss-config/nuxt', { /* options */ }],
],
}
This module works for both Nuxt 2 and Nuxt Vite
License
MIT License © 2023-PRESENT Chris