Closure Compiler in JavaScript
41–50 of 115 posts
Re: Closure Compiler in JavaScript
#42Earlier quoted context omitted.
The advanced compilation mode does some pretty powerful dead code removal and minification [1]. I guess that is available from plugins in Babel as well but Google has been using it for Gmail, Google.com etc, so it's quite battle tested. [1]: https://developers.google.com/closure/compiler/docs/api-tuto...
In my experience Babel minified better than Closure Compiler with less maintenance of the externs on my part.
Re: Closure Compiler in JavaScript
#43Earlier quoted context omitted.
Far less glamorous and way more old school, it's the later case - GWT can compile Java to JavaScript.
Wait, how is that a thing? I'm a pure JS developer (for now) but I don't understand how something framed on desktop OSs could compile to JS, a browser language. Does it compile to Node maybe? Which version of JS? EDIT: I'm googling now to learn more but I'm not asking to challenge anybody, I'm asking because probably you guys know more than me and I wanna know how this works.
Re: Closure Compiler in JavaScript
#44Earlier quoted context omitted.
Far less glamorous and way more old school, it's the later case - GWT can compile Java to JavaScript.
Wait, how is that a thing? I'm a pure JS developer (for now) but I don't understand how something framed on desktop OSs could compile to JS, a browser language. Does it compile to Node maybe? Which version of JS? EDIT: I'm googling now to learn more but I'm not asking to challenge anybody, I'm asking because probably you guys know more than me and I wanna know how this works.
GWT compiles Java to JS. If the Closure Compiler is mostly Java code, you only need to implement a few native code things (like replace file loading with just giving it source code as strings) in JS to do a cross compile to javascript.
Re: Closure Compiler in JavaScript
#45I'd love to see benchmarks comparing Closure Compiler JS, UglifyJS, and Babili.
Re: Closure Compiler in JavaScript
#46Earlier quoted context omitted.
The advanced compilation mode does some pretty powerful dead code removal and minification [1]. I guess that is available from plugins in Babel as well but Google has been using it for Gmail, Google.com etc, so it's quite battle tested. [1]: https://developers.google.com/closure/compiler/docs/api-tuto...
In my experience Babel minified better than Closure Compiler with less maintenance of the externs on my part.
Re: Closure Compiler in JavaScript
#47Earlier quoted context omitted.
Far less glamorous and way more old school, it's the later case - GWT can compile Java to JavaScript.
Wait, how is that a thing? I'm a pure JS developer (for now) but I don't understand how something framed on desktop OSs could compile to JS, a browser language. Does it compile to Node maybe? Which version of JS? EDIT: I'm googling now to learn more but I'm not asking to challenge anybody, I'm asking because probably you guys know more than me and I wanna know how this works.
And you don't even need to go down to that level of abstraction for Java-to-JavaScript, the two share many commonalities. Java classes can become JavaScript objects, Java methods can become JavaScript functions, Java exceptions can become JavaScript exceptions, and so on.
There's some things you can't directly translate (64-bit integer math, for instance), but these can be emulated.
As for “desktop” OS facilities, the browser may not be able to provide all of these, but whatever you need can be substituted (file access can be replaced with e.g. localStorage) or worked around.
Re: Closure Compiler in JavaScript
#48This is Google's JavaScript to JavaScript compiler, originally written in Java, but compiled with their Java to JavaScript compiler so that it runs in JavaScript... fair enough...
Re: Closure Compiler in JavaScript
#49Earlier quoted context omitted.
Far less glamorous and way more old school, it's the later case - GWT can compile Java to JavaScript.
Wait, how is that a thing? I'm a pure JS developer (for now) but I don't understand how something framed on desktop OSs could compile to JS, a browser language. Does it compile to Node maybe? Which version of JS? EDIT: I'm googling now to learn more but I'm not asking to challenge anybody, I'm asking because probably you guys know more than me and I wanna know how this works.
Re: Closure Compiler in JavaScript
#50This is Google's JavaScript to JavaScript compiler, originally written in Java, but compiled with their Java to JavaScript compiler so that it runs in JavaScript... fair enough...