Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thought about going to Google Closure? #19

Closed
kevmoo opened this issue Feb 18, 2011 · 9 comments
Closed

Thought about going to Google Closure? #19

kevmoo opened this issue Feb 18, 2011 · 9 comments

Comments

@kevmoo
Copy link
Contributor

kevmoo commented Feb 18, 2011

I've used it a bunch for the box2d work we've done at Pixel Lab.

Not only do you get amazing compression, but it's wonderful at finding bugs and tightening up documentation.

https://github.com/thinkpixellab/box2dWeb

I didn't see a discussion forum for Easel, so my apologies for opening an issue.

@gskinner
Copy link
Member

We are currently using google closure for compiling / minifying the EaselJS source.

@kevmoo
Copy link
Contributor Author

kevmoo commented Feb 18, 2011

Ooo...

Thoughts about using the Closure object model? -> http://code.google.com/closure/compiler/docs/js-for-compiler.html

You get a lot more love when you define types as closure requires. You can use their libraries, their vector types, etc.

Very very nice.

@mikechambers
Copy link
Contributor

Thanks for pointing this out. As Grant mentions, we currently use Google Closure for compiling and minification, and are converting docs over to Yui Doc format. Doing a quick scan, it looks like they are pretty compatible.

Once I finish the doc conversion, I will work on making sure that it is compatible with Google Closures annotation tags.

More infon on Yui Doc on our wiki:
https://github.com/gskinner/EaselJS/wiki/Documentation

@kevmoo
Copy link
Contributor Author

kevmoo commented Feb 18, 2011

...and to double down.

As a user of Easel, one can just include the git repo as a submodule.

Then when I build my app w/ Easel, the compiler only includes the bits of Easel I use, which makes everything much smaller.

@kevmoo
Copy link
Contributor Author

kevmoo commented Feb 18, 2011

To be clear: using closure's doc format is not enough.

You need to move from
(function(window){ var p = x.Foo.prototype; ... }

to

goog.provide("Foo");
Foo.prototype.method = function() {};

@kevmoo
Copy link
Contributor Author

kevmoo commented Feb 19, 2011

...and I'm happy to help. :-)

@mikechambers
Copy link
Contributor

Wont that require that anyone that uses EaselJS use the Google library stuff?

mike

@kevmoo
Copy link
Contributor Author

kevmoo commented Feb 19, 2011

Not at all, which really rocks.

There is a bit of work flagging your public surface area, but once that's done you get a completely contained library

...with whatever features of google closure JS you use (but only the features you use) baked in

If a user wants to just use your js file, great. No issues.

If a user wants to build against the Easel Sources w/ their own Closure project, then the above benefits (only include what they use, etc) come along.

@kevmoo
Copy link
Contributor Author

kevmoo commented Feb 19, 2011

Imagine you want to change the type of an API to be more specific...you get build errors on your samples if they don't comply with the new requirement.

...but you don't have to build as you're hacking if you don't want...the code works just great un-compiled.

It's magic. Makes me love JS.

...and it plugs in nicely with Coffee Script (http://jashkenas.github.com/coffee-script/) too

@gskinner gskinner closed this as completed Aug 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants