Search


Search something to see results

MinifyOptions

Minify options

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;
}

Hierarchy (View Summary)

Index

Properties

computeCalcExpression?: boolean

Compute css math functions

computeShorthand?: boolean

Compute shorthand properties

computeTransform?: boolean

Compute css transform functions

inlineCssVariables?: boolean

Inline css variables

minify?: boolean

Enable minification

nestingRules?: boolean

Generate nested rules

parseColor?: boolean

Parse color tokens

pass?: number

Define minification passes.

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);
removeEmpty?: boolean

Remove empty ast nodes

removePrefix?: boolean

Remove css prefix