Skip to content

pantoken / plugins/postcss/props-minify/src / flattenProperty

변수: flattenProperty

const flattenProperty: {(options?): Plugin; postcss: true; }

베타

flatten-@property PostCSS 플러그인을 생성합니다.

스타일시트의 모든 @property at-rule을 순회하여 각 initial-value 디스크립터를 추출하고, 제거 된 at-rule을 삭제한 후 추출된 모든 선언을 포함하는 단일 injectSelector { --name: value; … } 규칙을 앞에 추가합니다. 제거 후 남은 빈 규칙과 @layer 블록은 삭제됩니다.

Type Declaration

매개변수

options?

FlattenPropertyOptions

FlattenPropertyOptions.

반환값

Plugin

PostCSS 플러그인.

postcss

postcss: true

필수 PostCSS 플러그인 마커.

예제들

기본적으로 :root에 주입

ts
import postcss from "postcss";
import { flattenProperty } from "@pantoken/plugin-flatten-property";

const out = postcss([flattenProperty()]).process(css, { from: undefined }).css;

:scope에 주입 (scope 블록 내부에서 사용)

ts
import postcss from "postcss";
import { flattenProperty } from "@pantoken/plugin-flatten-property";

const out = postcss([flattenProperty({ injectSelector: ":scope" })]).process(css, { from: undefined }).css;
ts
Preserve