Opened 6 years ago

Closed 4 years ago

Last modified 3 years ago

#5885 closed feature (patcheswelcome)

Build: Try to use Closure Compiler's Advanced mode

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

Description (last modified by jzaefferer)

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 (10)

comment:1 Changed 6 years ago by jzaefferer

  • Description modified (diff)

comment:2 Changed 6 years ago by jzaefferer

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 6 years ago by jzaefferer

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 jzaefferer

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

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 jzaefferer

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

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:

http://missouristate.info/scripts/jquery.tooltip.js

http://missouristate.info/scripts/jquery.tooltip.min.js

http://missouristate.info/scripts/jquery.tooltip.externs.js

comment:6 Changed 5 years ago by jzaefferer

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:

http://missouristate.info/scripts/jquery-ui.externs.js

http://missouristate.info/scripts/jquery.core.min.js

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 jzaefferer

comment:9 Changed 4 years ago by scottgonzalez

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

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 scottgonzalez

  • Milestone TBD deleted

Milestone TBD deleted

Note: See TracTickets for help on using tickets.