putoutjs / minify

Minify with help of 🐊Putout
MIT License
12 stars 3 forks source link

@putout/minify NPM versionΒ Coverage Status

🐊Putout-based JavaScript minifier.

Install

npm i @putout/minify

Supported minifier transforms

Here is list of supported 🐊Putout transformations:

API

import {minify} from '@putout/minify';

minify(`
    const a = 5;
    const b = 6;

    fn(a, b);
`);
// returns
var a=5,b=6;fn(a,b);

Options

You can also pass options to minify. Here is list of default options:

({
    quotes: `'`,
    fixCount: 1, // the more fixCount - less output size
    conditions: false,
    mangleClassNames: true,
    mangle: true,
    mergeVariables: true,
    removeUnusedVariables: false,
    removeConsole: false,
    removeUselessSpread: true,
    applyTemplateLiterals: true,
    convertStrictEqualToEqual: false,
});

And usage example:

import {minify} from '@putout/minify';

const source = `
    const a = 5;
    const b = 6;
`;

minify(source, {
    removeUnusedVariables: false,
});

How it's compared to X(your benchmark)?

Benchmark

License

MIT