UNPKG

utquidem

Version:

The meta-framework suite designed from scratch for frontend-focused modern web development.

19 lines (16 loc) 463 B
import type { Declaration } from 'postcss'; export default ({ cssVarsHash = {}, }: { cssVarsHash?: Record<string, string> } = {}) => ({ postcssPlugin: 'postcss-replace-css-vars', Declaration(decl: Declaration) { if (decl.value && typeof decl.value === 'string') { decl.value = decl.value.replace(/--\S*/g, match => { if (cssVarsHash[match]) { return cssVarsHash[match]; } return match; }); } }, });