Skip to main content

Search and Top Navigation

#5885 closed feature (patcheswelcome)

Opened July 30, 2010 12:42PM UTC

Closed May 15, 2012 08:44PM UTC

Last modified October 11, 2012 09:15PM UTC

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

Probably needs some metadata to keep the right exports intact.

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

Attachments (0)
Change History (10)

Changed July 30, 2010 12:44PM UTC by jzaefferer comment:1

description: Probably needs some metadata to keep the right exports intact.Probably needs some metadata to keep the right exports intact. \ \ See http://code.google.com/closure/compiler/docs/api-tutorial3.html for details.

Changed July 30, 2010 01:03PM UTC by jzaefferer comment:2

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.

Changed July 30, 2010 01:04PM UTC by jzaefferer comment:3

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.

Changed October 18, 2010 02:56PM UTC by jzaefferer comment:4

resolution: → wontfix
status: newclosed

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.

Changed February 20, 2011 07:11PM UTC by jzaefferer comment:5

priority: minormajor
resolution: wontfix
status: closedreopened

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

Changed February 22, 2011 06:46PM UTC by jzaefferer comment:6

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/

Changed February 23, 2011 04:05PM UTC by ChadKillingsworth comment:7

_comment0: 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.1298477150832757
_comment1: 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.1298477344183462

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.

Changed May 23, 2011 06:04PM UTC by jzaefferer comment:8

Related core ticket: http://bugs.jquery.com/ticket/7318

Changed May 15, 2012 08:44PM UTC by scottgonzalez comment:9

resolution: → patcheswelcome
status: reopenedclosed

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

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:10

milestone: TBD

Milestone TBD deleted