4 ms·
> Can you absolutely trust Clojure(Script) and its tooling Totally. The closure compiler, despite it's age, is the best Javascript optimizer/uglifier out there
by bpicolo 9y ago
> Can you absolutely trust Clojure(Script) and its tooling
Totally. The closure compiler, despite it's age, is the best Javascript optimizer/uglifier out there. Nothing else comes close. There are several top notch, maintained frameworks as well (re-frame/om)
- vemv 9y agoBut then again, the npm and externs story is not complete yet... Sometimes I get the impression that other transpiled langs have npm + decent minification + decent non-minified compiled size, etc without having to wait for years. Of course, this can be changed (and Clojurists Together can be instrumental)!
- bpicolo 9y agoI don't think the externs story necessarily needs to be complete. The building blocks are all there waiting for you in Clojurescript. You might lose out on a particular library you like, or some random bootstrap + js re-integration, but overall clojurescript has a large number of libraries already available to build top notch frontends. The missing bits are usually small - I need support for <specific analytics library> and those are easy to rewrite, especially given an open-source PoC. The npm ecosystem is absolutely massive, but 99.999% of it is irrelevant for most frontend development. All that said, clojurescript is not necessarily the best choice for any given org. Mostly just saying there's nothing regarding the ecosystem that should hold you back.
- yorwba 9y agoBy closure compiler, do you mean https://github.com/google/closure-compiler https://github.com/google/closure-compiler ? Because I don't think it's related to Clojure in any way.
- snikeris 9y agoClojureScript uses Google's closure compiler.
- fulafel 9y agoThat's the secret sauce that ClojureScript relies upon for tree shaking, dead code elimination and other optimizations. The Closure library is also used for building blocks of the CLJS runtime. https://www.clojurescript.org/about/closure https://www.clojurescript.org/about/closure
- yorwba 9y agoSure, but it can be used on all things JavaScript. I guess I'm just confused why it'd be brought up as specific tooling for ClojureScript.
- KingMob 9y agoThat's actually not true. The Closure compiler has certain restrictions on the Js it accepts for advanced mode compilation, so you can't throw just anything at it. The advantage is best-in-class dead code elimination, which is also why Closure was chosen; to distill the CLojurescript standard library into just the parts needed for a web page requires good DCE. Recently, other Js projects like Rollup and Webpack have gotten good DCE, but when Clojurescript was started, there were no other serious contenders.
- bpicolo 9y agoIn the context of clojurescript you get 'advanced' optimizations free just by writing clojurescript. In JS you have to buy outside the modern JS ecosystem entirely. The closure compiler doesn't play well with any modern JS tooling, but modern JS tooling is nowhere near as capable at dead-code elimination, minification, and code-rewriting.