web-deploy/node_modules/@putout/minify
2024-04-26 18:37:00 +01:00
..
bundle Initial 2024-04-26 18:37:00 +01:00
LICENSE Initial 2024-04-26 18:37:00 +01:00
package.json Initial 2024-04-26 18:37:00 +01:00
README.md Initial 2024-04-26 18:37:00 +01:00

@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