@putout/minify

3.10.3ย โ€ขย Publicย โ€ขย Published

@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:

({
    mangleClassNames: true,
    mangle: true,
    removeUnusedVariables: true,
    removeConsole: false,
    removeUselessSpread: true,
    applyTemplateLiterals: true,
});

And usage example:

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

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

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

How it's compared to Terser?

For such code:

  • ๐Ÿ”ฅ @putout/minify: 473B
  • โŒ terser: 482B

react.js:

  • ๐Ÿ”ฅ @putout/minify: 16309B
  • โŒ terser: 16346B

License

MIT

Dependencies (0)

    Dev Dependencies (58)

    Package Sidebar

    Install

    npm i @putout/minify

    Weekly Downloads

    4,364

    Version

    3.10.3

    License

    MIT

    Unpacked Size

    1.67 MB

    Total Files

    4

    Last publish

    Collaborators

    • coderaiser