Optional
computecompute math functions see supported functions mathFuncs
Optional
computecompute shorthand properties
Optional
computecompute transform functions see supported functions transformFunctions
Optional
inlineinline css variables
Optional
minifyenable minification
Optional
nestinggenerate nested rules
Optional
parseparse color tokens
Optional
passdefine minification passes.
Optional
removeremove duplicate declarations from the same rule. if passed as a string array, duplicated declarations are removed, except for those in the array
import {transform} from '@tbela99/css-parser';
const css = `
.table {
width: 100%;
width: calc(100% + 40px);
margin-left: 20px;
margin-left: min(100% , 20px)
}
`;
const result = await transform(css, {
beautify: true,
validation: true,
removeDuplicateDeclarations: ['width']
}
);
console.log(result.code);
Optional
removeremove empty ast nodes
Optional
removeremove css prefix
minify options