esmangle
esmangle copied to clipboard
Add option to use ES.next syntax features for even smaller minified output
The option could be something like:
format: {
es6: true
}
…or es2015 or a more generic esnext.
A simple example of what it would do:
var foo = function(a) {
return a * 2;
};
…currently minifies to:
var foo=function(a){return a*2}
With ES.next syntax it could be:
var foo=a=>a*2
(Only watch out for function bodies that make use of the this binding.)
There’s far more things that could be done, e.g. string literals containing new line characters or lots of quotes could sometimes be shortened by using template strings, etc.
Nice. Now, escodegen already supports ES6.
So, to support it, we need to do,
- Update the parser
- Update the rules to support ES6 semantics
Maybe 1 is easy. We need to do 2.
After updating escope to support, we can work on (2) :)