Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You annotate methods in Google-JS-Closure with @public, @protected, and @private in comments.

Public methods get unmangled symbols. Everything else gets renamed to a short name to save bandwidth.

Dependencies are specified with goog.require.

Anything that doesn't get required with goog.require or isn't called by a public function gets culled.



While your integrating Closure Compiler's Advanced Mode, you might as well re-write your entire client side code... Because you'll likely have to.


Well, it's something we should look at, especially the library makers.

People who write ClojureScript regularly encounter this: we get this optimized and trimmed down app, and then something needs jQuery, so we have to pull all of it in. After you've used advanced compilation for a while, it feels downright dirty and wasteful to pull in entire blobs of code, not just the function trees you actually need.


You can also define a separate externs file with a list of symbols that shouldn't get mangled; this is useful if eg. you're using a third-party library that you don't want to modify.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: