Google hosts a number of JavaScript libraries such as jQuery and dojo on their CDN. For some reason, their own Google Closure library does not seem to be included. Is there a hosted version of the Closure library?
Asked
Active
Viewed 5,995 times
2 Answers
23
It's not included because Closure is intended to be used with the compiler; a hosted version would need to include the entire library and defeat the purpose of building minified libraries containing only the features you need.

Wooble
- 87,717
- 12
- 108
- 131
-
Thanks; I also discovered https://groups.google.com/group/closure-library-discuss/msg/1e2e4a47f0f47279 which says pretty much the same as you. Unfortunately this decision makes it somewhat difficult to distribute sample JS code as part of another project, that just happens to use the Google Closure library. – mjs Feb 07 '10 at 22:27
-
Well, they could provide a compiled unit and a symbol map to "resume compilation" using the same symbols. – thesmart Mar 16 '11 at 22:01
-
"somewhat difficult to distribute sample JS code as part of another project" I can't agree with that, if you organize your code into component, it could be reused across your projects. And the powerful compiler tool makes you get a great compact vertion of js file. – darkangel Nov 26 '10 at 05:07
-
What I mean is, I can't post a small code fragment somewhere which hauls the closure library in via ` – mjs Jun 02 '11 at 12:59
-
1Michael Bolin provides a simple subset of Closure: http://blog.bolinfest.com/2009/12/closure-lite-just-in-time-for-christmas.html – John Oct 27 '11 at 15:57
9
You can link to their repository:
<script src='https://cdn.rawgit.com/google/closure-library/master/closure/goog/base.js'></script>
good enough for demos or local development. As other answer suggested, production should use compiled code, it is well worth it.

Andi
- 199
- 2
- 9

Boycott Russia
- 11,818
- 5
- 28
- 29
-
1Move to `https://cdn.rawgit.com/google/closure-library/master/closure/goog/base.js` – Wernight Jul 29 '14 at 12:53