butternut icon indicating copy to clipboard operation
butternut copied to clipboard

The fast, future-friendly minifier

Results 66 butternut issues
Sort by recently updated
recently updated
newest added

```js // input if ( x ) { foo = 1; } else { foo = 2 } // output x?(foo=1):(foo=2) // better output foo=x?1:2 ``` ```js // input if...

better minification

```js // input function foo () { function bar () { console.log(42); } bar(); } // output function foo(){function a(){console.log(42)}a()} // better output function foo(){console.log(42)} ``` I think this basically...

better minification

If a variable has a literal value then in many cases it makes sense to inline the value, rather than declaring the variable: ```js // input var COUNT = 99;...

better minification

`(function () {}()}` can have no effect, and should be removed

better minification

Hey, Great lib :+1:. I was checking the online tool and I noticed that: `(function (xyz) {});` gave the output: `(function(a){})` I expected to receive: `(function(){})`

better minification

This can have a substantial impact on generated code size. Would like it to be automated though — no annotations or white/blacklists, instead Butternut should ideally be smart enough to...

better minification

If there's an `import`/`export` declaration, we know that this is a module and that it's therefore safe to a) mangle/remove top-level declarations, and b) remove 'use strict' pragmas. Probably makes...

better minification

In this example: ```js let foo = false; if (foo) console.log('ohno'); ``` The whole `if` block should get removed. This is very useful for removing development only code blocks from...

better minification

*Edited: no longer a bug, but suboptimal output* ```js // input (function () { var {foo,bar} = obj; console.log(foo); }()) // expected !function(){var {foo:a}=obj;console.log(a)}() // or maybe !function(){console.log(obj.foo)}() // actual...

better minification

Although butternut appears to be much faster than uglifyjs, it would be nice to also see memory comparisons. I've got a few tasks where uglifyJS gives me no problems, but...