CustomUnitPostCSS
CustomUnitPostCSS - Плагин для замены кастомный юнитов в стилях
В данном случае плагин заменяет выражение такого типа, как 1.5--lfs или -.5--custom-unit на calc(1.5 * var(--lfs)) и calc(-.5 * var(--custom-unit)).
Stylus вставляет пробел между числом и юнитом. Поэтому в этом плагина предусмотрен пробел при замене.
Usage with PostCSS API
import postcss from 'postcss';
import CustomUnitPostCSSPlugin from 'shared-front/postcss-plugins/custom-unit';
postcss([CustomUnitPostCSSPlugin])
.process(
`
.foo {
font-size 5--custom-unit
}
`,
{ from: undefined },
)
.then(({ css }) => css);
Usage with Nuxt
// nuxt.config.js
export default {
postcss: {
plugins: [CustomUnitPostCSSPlugin]
},
};