DEV Community

bop
bop

Posted on

What's the simplest way to compile ClojureScript to JS? Like 1 file, no overhead.

Top comments (1)

Collapse
 
deciduously profile image
Ben Lovy

I think the best overall solution is shadow-cljs, but this requires a project setup. If you just want to transform some CLJS code, try something like this in a CLJS repl:

(require '[cljs.js :refer [empty-state compile-str]])

(compile-str (empty-state) "(defn add [x y] (+ x y))" #(println (:value %)))
Enter fullscreen mode Exit fullscreen mode

Check the cljs.js/compile-str docs.