Ticket #5885 (closed feature: patcheswelcome)

Opened 5 years ago

Last modified 3 years ago

Build: Try to use Closure Compiler's Advanced mode

Reported by: joern.zaefferer Owned by:
Priority: major Milestone:
Component: [meta] ui.build Version: 1.8.2
Keywords: Cc:
Blocking: Blocked by:

Description (last modified by joern.zaefferer) (diff)

Probably needs some metadata to keep the right exports intact.

See  http://code.google.com/closure/compiler/docs/api-tutorial3.html for details.

Change History

comment:1 Changed 5 years ago by joern.zaefferer

  • Description modified (diff)

comment:2 Changed 5 years ago by joern.zaefferer

jquery-ui.min.js ADVANCED: 150kb, SIMPLE: 194kb. Doesn't work out-of-the-box, looks like too many externaly defined properties, eg. jQuery core methods, are renamed.

Accordin to the docs, we'd have to compile the full page scripts all in one go. The only other option is to use externs, where the compiled code declares functions with empty bodies for all functions it uses. That doesn't seem feasible for the jQuery Core dependency.

comment:3 Changed 5 years ago by joern.zaefferer

So far I'd the only thing we can do is to document how to use the Closure Compiler on an application-level. It doesn't look like we can provide a pre-compiled version of jQuery UI with the ADVANCED mode.

comment:4 Changed 5 years ago by joern.zaefferer

  • Status changed from new to closed
  • Resolution set to wontfix

After some discussion at the jQuery Conference I'm confident that the Advanced Mode is useful only on an application level, where libaries like jQuery are declared as external dependencies.

comment:5 Changed 5 years ago by joern.zaefferer

  • Priority changed from minor to major
  • Status changed from closed to reopened
  • Resolution wontfix deleted

Reopening after getting some useful input on this. We should try the mode on one plugin to see what the difference in size could be.

For the minifier to work, we'd need to specify all public symbols (or whatever that should be called). Here's a reference with some standalone tooltipl plugin:




comment:6 Changed 5 years ago by joern.zaefferer

Even more useful input, with some documentation on how to create thesefiles:  http://blogs.missouristate.edu/web/2011/02/14/jquery-plugins-and-closure-compiler/

comment:7 Changed 5 years ago by ChadKillingsworth

As a test case, I defined the externs needed and compiled jquery.core.js. Without modifying the core.js source in any way I get 3 warnings (I use VERBOSE warnings settings on the compiler). However, the resulting code is smaller and passes all unit tests:



I should note that I use a very recent build of the compiler and turn on the non-standard AmbiguateProperties and DisambiguateProperties passes which give slightly better results.

I also use/reference the jQuery 1.5 externs:  http://closure-compiler.googlecode.com/svn/trunk/contrib/externs/jquery-1.5.js. While I realize that UI still depends upon jQuery 1.4.4, the externs for 1.5 are much more accurate as I refine the generation program with every new release.

Last edited 5 years ago by ChadKillingsworth (previous) (diff)

comment:8 Changed 5 years ago by joern.zaefferer

comment:9 Changed 4 years ago by scott.gonzalez

  • Status changed from reopened to closed
  • Resolution set to patcheswelcome

This isn't something we're looking into. Perhaps if core adds suport, we will look into this.

comment:10 Changed 3 years ago by scott.gonzalez

  • Milestone TBD deleted

Milestone TBD deleted

Note: See TracTickets for help on using tickets.