@csstools/postcss-stepped-value-functions
Version:
Use round, rem and mod functions in CSS
2 lines (1 loc) • 397 B
JavaScript
import{calc as e}from"@csstools/css-calc";const s=/(?<![-\w])(?:mod|rem|round)\(/i,creator=o=>{const t=Object.assign({preserve:!1},o);return{postcssPlugin:"postcss-stepped-value-functions",Declaration(o){if(!s.test(o.value))return;const r=e(o.value,{precision:5,toCanonicalUnits:!0});r!==o.value&&(o.cloneBefore({value:r}),t.preserve||o.remove())}}};creator.postcss=!0;export{creator as default};