ice/packages/plugin-unocss
ClarkXia d4f01b8f6a
chore: update versions (#6794)
2024-02-26 10:34:50 +08:00
..
src feat: use postcss plugin to transform unocss (#6790) 2024-02-18 11:57:19 +08:00
CHANGELOG.md chore: update versions (#6794) 2024-02-26 10:34:50 +08:00
README.md feat: support plugin of unocss (#6665) 2023-11-29 15:31:20 +08:00
package.json chore: update versions (#6794) 2024-02-26 10:34:50 +08:00
tsconfig.json feat: support plugin of unocss (#6665) 2023-11-29 15:31:20 +08:00
uno.css feat: use postcss plugin to transform unocss (#6790) 2024-02-18 11:57:19 +08:00

README.md

@ice/plugin-unocss

A plugin for enable unocss in your app based on @ice/app.

Usage

Install @ice/plugin-unocss:

$ npm install @ice/plugin-unocss --save-dev

Configure it in ice.config.mts:

import { defineConfig } from '@ice/app';
import Unocss from '@ice/plugin-unocss';

export default defineConfig(() => ({
  plugins: [
    Unocss(),
  ]
}));

Plugin Options

Plugin options is as same as UnoCSS ConfigFle.

Plugin has a default preset @unocss/preset-uno for UnoCSS. You can pass options of presets to override the default preset:

import { defineConfig } from '@ice/app';
import Unocss from '@ice/plugin-unocss';
import {
  defineConfig,
  presetAttributify,
  presetIcons,
  presetTypography,
  presetUno,
  presetWebFonts,
  transformerDirectives,
  transformerVariantGroup
} from 'unocss';

export default defineConfig(() => ({
  plugins: [
    Unocss({
      shortcuts: [
        // ...
      ],
      theme: {
        colors: {
          // ...
        }
      },
      presets: [
        presetUno(),
        presetAttributify(),
        presetIcons(),
        presetTypography(),
        presetWebFonts({
          fonts: {
            // ...
          },
        }),
      ],
      transformers: [
        transformerDirectives(),
        transformerVariantGroup(),
      ],
    }),
  ],
}));