Integracja Astro
Integracja UnoCSS dla Astro: @unocss/astro. Zobacz przykład.
Instalacja
bash
pnpm add -D unocssbash
yarn add -D unocssbash
npm install -D unocssbash
bun add -D unocssts
import { defineConfig } from 'astro/config'
import UnoCSS from 'unocss/astro'
export default defineConfig({
integrations: [
UnoCSS(),
],
})Utwórz plik uno.config.ts:
ts
import { defineConfig } from 'unocss'
export default defineConfig({
// ...Opcje UnoCSS
})Reset stylów
Domyślnie reset stylów przeglądarki nie zostanie wstrzyknięty. Aby go włączyć, zainstaluj pakiet @unocss/reset:
bash
pnpm add -D @unocss/resetbash
yarn add -D @unocss/resetbash
npm install -D @unocss/resetbash
bun add -D @unocss/resetI zaktualizuj swój astro.config.ts:
ts
import { defineConfig } from 'astro/config'
import UnoCSS from 'unocss/astro'
export default defineConfig({
integrations: [
UnoCSS({
injectReset: true // or a path to the reset file
}),
],
})Usage without presets
This plugin does not come with any default presets.
bash
pnpm add -D @unocss/astrobash
yarn add -D @unocss/astrobash
npm install -D @unocss/astrobash
bun add -D @unocss/astrots
import UnoCSS from '@unocss/astro'
export default {
integrations: [
UnoCSS(),
],
}For more details, please refer to the Vite plugin.
INFO
If you are building a meta framework on top of UnoCSS, see this file for an example on how to bind the default presets.
Notes
client:only components must be placed in components folder or added to UnoCSS's content config in order to be processed.