MinifyOptions
interface MinifyOptions {
computeCalcExpression?: boolean;
computeShorthand?: boolean;
computeTransform?: boolean;
inlineCssVariables?: boolean;
minify?: boolean;
nestingRules?: boolean;
parseColor?: boolean;
pass?: number;
removeDuplicateDeclarations?: string | boolean | string[];
removeEmpty?: boolean;
removePrefix?: boolean;
}
computeCalcExpression?: boolean;
computeShorthand?: boolean;
computeTransform?: boolean;
inlineCssVariables?: boolean;
minify?: boolean;
nestingRules?: boolean;
parseColor?: boolean;
pass?: number;
removeDuplicateDeclarations?: string | boolean | string[];
removeEmpty?: boolean;
removePrefix?: boolean;
}
Hierarchy (View Summary)
- MinifyOptions
Index
Properties
node.MinifyOptions.computeCalcExpressionnode.MinifyOptions.computeShorthandnode.MinifyOptions.computeTransformnode.MinifyOptions.inlineCssVariablesnode.MinifyOptions.minifynode.MinifyOptions.nestingRulesnode.MinifyOptions.parseColornode.MinifyOptions.passnode.MinifyOptions.removeDuplicateDeclarationsnode.MinifyOptions.removeEmptynode.MinifyOptions.removePrefix
Properties
Optionalcompute Calc Expression
computeCalcExpression?: boolean
Compute css math functions
Optionalcompute Shorthand
computeShorthand?: boolean
Compute shorthand properties
Optionalcompute Transform
computeTransform?: boolean
Compute css transform functions
Optionalinline Css Variables
inlineCssVariables?: boolean
Inline css variables
Optionalminify
minify?: boolean
Enable minification
Optionalnesting Rules
nestingRules?: boolean
Generate nested rules
Optionalparse Color
parseColor?: boolean
Parse color tokens
Optionalpass
pass?: number
Define minification passes.
Optionalremove Duplicate Declarations
removeDuplicateDeclarations?: string | boolean | string[]
Remove 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);
Optionalremove Empty
removeEmpty?: boolean
Remove empty ast nodes
Optionalremove Prefix
removePrefix?: boolean
Remove css prefix
Minify options