andriy-gerasika / openid-selector

Automatically exported from code.google.com/p/openid-selector
1 stars 1 forks source link

Support Google Closure Library #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

could you please also support the Google Closure Library 
(http://code.google.com/p/closure-library/)?

For some basic information about Google Closure, see 
http://stackoverflow.com/questions/1690197/what-does-google-closure-library-offe
r-over-jquery

Sincerely yours,
Martin

Original issue reported on code.google.com by themoose...@googlemail.com on 1 Mar 2011 at 9:57

GoogleCodeExporter commented 9 years ago
sorry, I have no Google Closure experience

feel free to write your own Google Closure backend using MooTools/Prototype 
backends as an example

when it will be ready, attach it to this issue, I'll be happy to include it 
into openid-selector

Original comment by andriy.gerasika on 2 Mar 2011 at 4:45

GoogleCodeExporter commented 9 years ago
I have created the Google Closure Script today.

The compiled version can be generated like this:

python ../closure-library/closure/bin/calcdeps.py \
-i ../closure-library/closure/goog/deps.js \
-i js/openid-closure.js \
-p ../closure-library/closure/goog/ \
-o compiled \
-c ../closure-compiler/build/compiler.jar \
-f "--compilation_level=ADVANCED_OPTIMIZATIONS" \
-f "--warning_level=VERBOSE" \
-f "--define=goog.LOCALE='de'" \
-f "--define=moose.ALLOW_AUTOLOGIN=true" \
-f "--externs=js/externs.js" > js/openid-closure-compiled.js

0 error(s), 2 warning(s), 90,7% typed

The compiled version doesn't work at the moment. I try to get that fixed and 
I'll upload the new version.

Original comment by themoose...@googlemail.com on 2 Mar 2011 at 5:01

Attachments:

GoogleCodeExporter commented 9 years ago
Now it works with the compiled version.

2 jQuery files need 59,9 kB;
3 Mootools files need 202,2 kB;
2 Prototype files need 164,3 kB;
1 Google Closure file needs 8,8 kB :D

Original comment by themoose...@googlemail.com on 2 Mar 2011 at 6:18

Attachments:

GoogleCodeExporter commented 9 years ago
I have incorporated first set of attachments

but I do not follow what is externs.js -- is it required for openid-closure.js 
to function?

Original comment by andriy.gerasika on 5 Mar 2011 at 5:20

GoogleCodeExporter commented 9 years ago
actually, incorporated second set of files

Original comment by andriy.gerasika on 5 Mar 2011 at 5:52

GoogleCodeExporter commented 9 years ago
>>> what is externs.js -- is it required for openid-closure.js to function?
In short: Yes, you need it. You can rename it if you want, but the file is 
needed.

The long explanation:
Google Closure can be very small, if you compile all your scripts at once (see 
python ../closure-library/closure/bin/calcdeps.py ... and 
openid-closure-compiled.js)
If you have another script called "accordeon.js" you would add "-i 
js/accordeon.js".
The whole Closure library needs about 14 MB. But you will never need the whole 
library. 
The Closure Compiler checks which functions you need and will add only the 
needed ones. The Closure Compiler also does massive renaming. Every function, 
variable, method that can get a smaller name, gets one (see 
openid-closure-compiled.js). Thus you need a file (externs.js) which tells the 
Compiler which names sould not be renamed.

Thanks for adding the Closure files.

Original comment by themoose...@googlemail.com on 5 Mar 2011 at 8:52