Skip to content

Astro Integration

Astro için UnoCSS entegrasyonu: @unocss/astro. Örneği kontrol edin.

Installation

bash
pnpm add -D unocss
bash
yarn add -D unocss
bash
npm install -D unocss
bash
bun add -D unocss
ts
import { defineConfig } from 'astro/config'
import UnoCSS from 'unocss/astro'

export default defineConfig({
  integrations: [
    UnoCSS(),
  ],
})

Bir uno.config.ts dosyası oluşturun:

ts
import { defineConfig } from 'unocss'

export default defineConfig({
  // ...UnoCSS seçenekleri
})

Style Reset

Varsayılan olarak, tarayıcı stil sıfırlama enjekte edilmeyecektir. Etkinleştirmek için @unocss/reset paketini yükleyin:

bash
pnpm add -D @unocss/reset
bash
yarn add -D @unocss/reset
bash
npm install -D @unocss/reset
bash
bun add -D @unocss/reset

Ve astro.config.ts'nizi güncelleyin:

ts
import { defineConfig } from 'astro/config'
import UnoCSS from 'unocss/astro'

export default defineConfig({
  integrations: [
    UnoCSS({
      injectReset: true // veya sıfırlama dosyasına bir yol
    }),
  ],
})

Preset olmadan kullanım

Bu eklenti herhangi bir varsayılan preset ile gelmez.

bash
pnpm add -D @unocss/astro
bash
yarn add -D @unocss/astro
bash
npm install -D @unocss/astro
bash
bun add -D @unocss/astro
ts
import UnoCSS from '@unocss/astro'

export default {
  integrations: [
    UnoCSS(),
  ],
}

Daha fazla ayrıntı için lütfen Vite eklentisine bakın.

INFO

UnoCSS üzerine bir meta çerçeve oluşturuyorsanız, varsayılan preset'leri nasıl bağlayacağınıza dair bir örnek için bu dosyaya bakın.

Notes

client:only bileşenleri components klasörüne yerleştirilmeli veya işlenmek üzere UnoCSS'in content yapılandırmasına eklenmelidir.

Released under the MIT License.