DEV Community

bop
bop

Posted on

2

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.

SurveyJS custom survey software

JavaScript UI Library for Surveys and Forms

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

View demo

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay