• ☆ Yσɠƚԋσʂ ☆
    link
    3
    edit-2
    3 years ago

    Highly recommend checking out ClojureScript as an alternative to Js. It’s a functional language that treats Js as a compile target, but also offers great interop for cases where you do need things from Js ecosystem. ClojureScript compiler does minification and code pruning out of the box. Code pruning works down to function level because the compiler can reliably tell where a function comes from and where it’s used. If you include a library and use single function from it that’s what gets included. The compiler is also able to do things like code splitting based on namespace hierarchy. So, you can trivially break up your app into separate bundles.

    All of these things are really important for front-end code since you want to reduce bundle size that’s sent to the browser. And while it’s possible to do a lot of this stuff with js, it’s not consistent or reliable.

    This front-end framework comparison shows some of the advantages in practice. ClojureScript based re-frame results in small bundles, great performance, and tiny amounts of code.

    One of the best things about ClojureScript is the workflow which is fully interactive. Any time you make changes to your code those get pushed to the browser and reflected instantly without losing any application state in the process. This is an incredibly nice feature for developing complex apps where you need to put the UI in a particular state to add a new feature. Having to reload the page and redo all the steps becomes very tedious.

    Finally, here’s a quick start workshop for getting the feel of what the workflow feels like https://github.com/ClojureTO/JS-Workshop/tree/shadow-cljs

    • dinomugOPM
      link
      23 years ago

      It is funny that the author being a java expert and a lisp programmer (Common Lisp) doesn’t work with clojure/clojurescript which is the best of both worlds. Hilarious 😂