Preset Legacy Compat
Kolekcja narzędzi kompatybilności wstecznej.
Ten preset nie zawiera żadnych reguł, stosuje postprocess do wygenerowanego CSS z innych presetów.
Domyślnie żadne opcje nie są włączone, musisz jawnie wybrać każdą z nich.
Instalacja
bash
pnpm add -D @unocss/preset-legacy-compatbash
yarn add -D @unocss/preset-legacy-compatbash
npm install -D @unocss/preset-legacy-compatbash
bun add -D @unocss/preset-legacy-compatts
import presetLegacyCompat from '@unocss/preset-legacy-compat'
import { defineConfig } from 'unocss'
export default defineConfig({
presets: [
// ...inne presety
presetLegacyCompat({
// opcje
commaStyleColorFunction: true,
legacyColorSpace: true
}),
],
})Options
commaStyleColorFunction
- Type:
boolean - Default:
false
Convert color functions (rgb() and hsl()) from space-separated to comma-separated, for better compatibility with legacy browsers. Bring back the old behavior before UnoCSS v0.57.0 that was changed to space-separated in #3221 to align with Tailwind CSS.
For examples:
rgb(255 0 0)->rgb(255, 0, 0)rgb(255 0 0 / 50%)->rgba(255, 0, 0, 50%)hsl(0 100% 50% / 50%)->hsla(0, 100%, 50%, 50%)
legacyColorSpace
- Type:
boolean - Default:
false
Removes color space keywords such as in oklch and in oklab from the generated styles. This is useful for ensuring compatibility with legacy browsers that do not support these modern color spaces.
To enable this feature, set the legacyColorSpace option to true.