News for hackers. Stuff that matters.
Re:Some analysis of the 1M most popular sites on the web by jacquesm on Friday July 24, 2015 @01:26PM (#9943614)
How would the closure compiler figure out what bits and pieces of the library are triggered from the html portion of the site? (I can see how it can track the javascript bits but unless your site is entirely generated from js you'd have to start with the html)
Re:Some analysis of the 1M most popular sites on the web by cbhl on Friday July 24, 2015 @01:41PM (#9943756)
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.

Re:Some analysis of the 1M most popular sites on the web by euroclydon on Friday July 24, 2015 @03:10PM (#9944426)
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.
Re:Some analysis of the 1M most popular sites on the web by jwr on Saturday July 25, 2015 @03:56AM (#9946941)
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.

Re:Some analysis of the 1M most popular sites on the web by nostrademons on Friday July 24, 2015 @02:01PM (#9943916)
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.
Re:Some analysis of the 1M most popular sites on the web by jwr on Saturday July 25, 2015 @03:48AM (#9946914)
Google Closure compiler looks at all of your JavaScript at once and throws out whatever isn't actually used. So, if you call your JavaScript from HTML somewhere else, you need to explicitly list the functions you use.