Hacker News new | ask | show | jobs
by Deadron 1476 days ago
The tooling is far from simplistic to setup and the available options can be overwhelming. Its all the pain of the JS stack but with less easily available help and tooling that produces less helpful error messages.
3 comments

I think the tooling nowadays is pretty simple to setup, but the information out there doesn't speak to that new simple way, so everyone starting is following something that pushes them to outdated tooling.

Install Java:

    brew tap homebrew/cask-versions
    brew install --cask temurin17
Install Clojure:

    brew install clojure/tools/clojure
Type `clj` at the command line and play with Clojure!

Now install VSCode and get the Calva plugin for Clojure from the marketplace.

That's it. You'll have autocompletion, jump to definition, code formatting and highlighting, linting, support for editor integrated REPL, debugger, etc.

Then you can run:

    clojure -Ttools install io.github.seancorfield/deps-new '{:git/tag "v0.4.9"}' :as new
And now you can create new projects from various templates using:

    clojure -Tnew app :name myusername/mynewapp
This creates a new basic application project for example. Open it in VSCode and you can connect a REPL to it and start working.
The errors are bad, but understandable in 99% of cases with a little experience (like 2-3 weeks).

And the stuff about the tooling is flat out wrong. The CLJS tooling is light years ahead of JS tooling in my experience. Maybe that was different back in the day, but shadow-cljs is seamless. Vastly superior to working with package.json/babelrc/postcssrc/webpack.config.js/etc/etc/etc

If you are going to compare modern CLJS tooling against JS - you should also compare against modern JS tooling like esbuild/vitejs which operate at light-speed.
I don’t think it’s that

    $ npx nbb -e (println "Hello, world")
    Need to install the following packages:
      nbb
    Ok to proceed? (y)
    Hello, world
Or more comprehensively: https://clojurescript.org/guides/quick-start
Your example is missing anything actually related to rendering a webpage.
Unclear what "rendering a webpage" entails exactly.

If you want to do frontend development, you can give shadow-cljs a try, the quickstart is pretty quick: https://github.com/thheller/shadow-cljs#quick-start

If you want to just render server-side HTML, something like compojure (HTTP routing) and hiccup (Clojure data -> HTML) is pretty easy and quick to get started with (https://gist.github.com/zehnpaard/2071c3f55ed319aa8528d54d90...).

If you want to generate HTML files to serve with nginx/whatever, you can just use hiccup and `(spit)` the resulting HTML to files on disk.