Side navigation
#7318 closed feature (wontfix)
Opened October 26, 2010 02:56PM UTC
Closed November 29, 2010 12:19AM UTC
Last modified May 03, 2012 01:05AM UTC
Support Closure Compiler ADVANCED_OPTIMIZATIONS
Reported by: | cjavapro@gmail.com | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | misc | Version: | 1.4.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If I paste jQuery minified code to the top of my JS file and my code to the bottom, It works fine uncompiled.
If I use closure compiler in simple optimizations it works fine
I want to be able to use advanced. That would allow some of the unused jquery functions to be stripped out altogether!! AND the ones I use would be shortened!!
Unfortunately.. in 1.4.2 mouseout is stripped out whether I use it or not and in 1.4.3 I get an error within the jquery code that exec is not defined.
Attachments (0)
Change History (14)
Changed October 26, 2010 08:15PM UTC by comment:1
component: | unfiled → misc |
---|---|
keywords: | → needsreview |
milestone: | 1.5 |
priority: | undecided → low |
summary: | I want to be able to use Google Closure Compiler ADVANCED_OPTIMIZATIONS → Support Closure Compiler ADVANCED_OPTIMIZATIONS |
type: | enhancement → feature |
Changed November 02, 2010 02:27AM UTC by comment:2
More info about advanced optimizations:
http://code.google.com/closure/compiler/docs/api-tutorial3.html#dangers
Doesn't seem worth the effort to me.
Changed November 29, 2010 12:19AM UTC by comment:3
resolution: | → wontfix |
---|---|
status: | new → closed |
Nope; the ability for people to duck punch most of the jQuery functions to enhance functionality means this wouldn’t work properly for standalone jQuery files, and writing code to conform to Closure Compiler’s ADVANCED_OPTIMIZATIONS mode is a huge undertaking that very few people will actually bother to do.
I’m also fairly confident that our expando-generating stuff (the code that generates the bind-alias methods like .click
) will never work properly, and it’s looking increasingly likely that we are going to start using UglifyJS for minification in the future since it results in smaller code.
Changed December 24, 2010 05:01AM UTC by comment:4
keywords: | needsreview |
---|
Changed February 24, 2011 10:40PM UTC by comment:5
I would really like to see the advanced mode of Google Closure Compiler supported. It would be useful for my project.
Changed February 24, 2011 10:45PM UTC by comment:6
Replying to [comment:5 andrearo@…]:
I would really like to see the advanced mode of Google Closure Compiler supported. It would be useful for my project.
It would be a large decision for them to do this (I wish they would). Every single name would have to be either variable form
$.animation = {swing: function () {...}}
or string form
$['animation'] = {'swing': function () {...}}
This would have to be
1. considered for every item
and
2. maintained ongoing
I would expect animation can be renamed and swing cannot
$.animation = {'swing': function () {...}}
Changed February 24, 2011 10:46PM UTC by comment:7
_comment0: | {{{ \ It’s looking increasingly likely that we are going to start using UglifyJS for minification in the future since it results in smaller code. \ }}} \ \ We've since switched to UglifyJS, so this is a moot point at this point → 1298587695251403 |
---|
Changed February 24, 2011 10:49PM UTC by comment:8
Replying to [comment:7 ajpiano]:
> It’s looking increasingly likely that we are going to start using UglifyJS for minification in the future since it results in smaller code. >We've since switched to UglifyJS, so this is a moot point at this point
I would say just because you use UglifyJS, that does not mean that you cannot support Closure Compiler.
There is the risk that the changes would cause UglifyJS to be less effective. I do not know.
Changed May 23, 2011 05:34PM UTC by comment:10
The discussion here in regards to what is necessary to support Closure Compiler is at least incomplete, more likely just wrong. See http://closure-compiler.googlecode.com/svn/trunk/contrib/externs/jquery-1.5.js
jQuery could never distribute a minified version via advanced mode (that just makes no sense in this context), but maintaining the externs file and documenting how to use it to minify application could be a very good answer to the "jQuery is too big" problem.
Changed May 23, 2011 06:34PM UTC by comment:11
@jzaefferer
>The discussion here in regards to what is necessary to support Closure Compiler is at least incomplete, more likely just wrong
I know this is a sloppy conversation, but I think I am able to defend and explain any of the comments I have made.
>jQuery could never distribute a minified version via advanced mode
That is obvious for those who understand advanced mode. The reason is that jQuery and the application's code are supposed to be minified together. The distributed minified version can stay as UglifyJS, the one for advanced mode would stay unminified because it would take advantage of advanced mode when the time comes.
>maintaining the externs file and documenting how to use it to minify application could be a very good answer to the "jQuery is too big" problem
The externs file will allow us to use jQuery in our code which is already configured for advanced mode, but it will not make jQuery any smaller. Only advanced mode would allow removal of all unused jQuery functions, excluding the ones that are written in string style, for example $['click'] = function(...){...}
.
Changed June 27, 2011 03:43AM UTC by comment:12
It is too difficult that using the advanced mode of Google Closure Compiler .
If the externs are using jquery-xx.min.js , Closure Compiler reports many error....
Changed July 29, 2011 02:46PM UTC by comment:13
yes, it would be great if the jQuery team could provide an official "externs" file, like the one linked above. Closure (Compiler, Templates, Library, ...) is an amazing value for the JS community. I would expect most Closure users to use its "goog.dom" components, but JQuery could very well live in many projects.
Changed May 03, 2012 01:05AM UTC by comment:14
Note that there is a similar ticket which is open (at the time of this writing) . See #11015, "Integrate with Closure Compiler". This ticket also appears on the 1.8 Ticket Vote. Hope springs eternal! :D
I’m not sure if the effort to support ADVANCED_OPTIMIZATIONS is worth the size benefits it might provide, but we’ll take a look.