Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to use ES.next syntax features for even smaller minified output #100

Open
mathiasbynens opened this issue Feb 5, 2015 · 1 comment

Comments

@mathiasbynens
Copy link
Contributor

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.

@mathiasbynens mathiasbynens changed the title Add option to use ES.next syntax for even smaller minified output Add option to use ES.next syntax features for even smaller minified output Feb 5, 2015
@Constellation
Copy link
Member

Nice. Now, escodegen already supports ES6.
So, to support it, we need to do,

  1. Update the parser
  2. 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) :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants