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 --minify #143

Closed
kazuho opened this issue Apr 19, 2013 · 7 comments
Closed

Add --minify #143

kazuho opened this issue Apr 19, 2013 · 7 comments
Assignees

Comments

@kazuho
Copy link
Member

kazuho commented Apr 19, 2013

Add support for minification at the JSX compiler level, for better compression ratio and ease of use.

Background: JavaScript-level minifiers have problem in efficiency and maintaining compatibility, since it cannot use any type information (i.e. property names that need to be preserved needs to be listed, and those listed would never get minified even when possible).

Note: introduce export attribute for classes / functions of which names should be preserved so that they would be callable from JavaScript.

@kazuho
Copy link
Member Author

kazuho commented Apr 19, 2013

The work is ongoing on kazuho/experiments/minify4.

@kazuho
Copy link
Member Author

kazuho commented Apr 30, 2013

Support for minification (turned on by specifying "--minify" as a compile option) has been introduced to master at commit dc3f7cc.

There should be no side-effects to the generated code (when to using --minify) expect for the fact that support for annocated comments targeting the Google Closure Compiler minifier has been dropped (Google Closure Compiler should continue to work wo. type annotations).

Things yet to be done:

  • do not emit unused code
  • merge identical strings
  • adjust the code emitter for certain expressions (e.g. instanceof) so that the generated code would be shorter

@kazuho
Copy link
Member Author

kazuho commented Apr 30, 2013

A brief description of the minification and export rules can be found at https://github.com/jsx/JSX/wiki/Minification-and-export-rules

@kazuho
Copy link
Member Author

kazuho commented May 7, 2013

Closing the issue as finished.

  • do not emit unused code
  • merge identical strings
  • adjust the code emitter for certain expressions (e.g. instanceof) so that the generated code would be shorter

Regarding these three leftovers, work on the first has been finished (see #157). It would be preferable to work on the other two as well, but they are considered low priority since they would only have small effect in terms of code size.

@kazuho kazuho closed this as completed May 7, 2013
@gfx
Copy link
Member

gfx commented May 7, 2013

Ho about combination of --minify and --enable-source-map?

@kazuho
Copy link
Member Author

kazuho commented May 7, 2013

@gfx
Thank you for pointing that out. Opened a separate issue.

@gfx
Copy link
Member

gfx commented May 7, 2013

👍

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

No branches or pull requests

2 participants