@tbela99/css-parser
    Preparing search index...

    Interface 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 math functions see supported functions mathFuncs

    computeShorthand?: boolean

    compute shorthand properties

    computeTransform?: boolean

    compute transform functions see supported functions transformFunctions

    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