Fork me on GitHub

how to run clojurescript command in terminal?


something like cljs -m namespace


When I run clj -m namespace it looks for .clj and .cljc files but not .cljs files

👀 3

According to Clojurescript doc here > Running Tests > You can run tests by using the `cljs.test/run-tests` macro. This may be done in your REPL or at the end of your file. If you have many test namespaces it’s idiomatic to create a test runner namespace which imports all of your test namespaces and then invokes `run-tests`. So I created the file server.cljs.tests

(ns server.cljs.tests
  (:require [cljs.test :refer-macros [run-tests]]


(defn runn []
I have a test at server.cljs.history_test . But when I run function runn in repl with
ClojureScript 1.10.238
cljs.user=> (require '[server.cljs.tests :refer [runn]])
cljs.user=> (runn)

Testing server.cljs.tests

Ran 0 tests containing 0 assertions.
0 failures, 0 errors.
It seems run-tests is enable to discover the tests in server.cljs.history_test namescpace.


Good morning. Anyone knows why most ”common” clojure.* libraries are renamed cljs.* in ClojurScript?


In short, has to do with macros. In long: Edit: see now that thheller was about couple of hours faster 😄


I appreciate the link, so good that you missed Thomas’ answer. 😃

😄 3

the link also explains it much better. didn't know that existed 🙂


@pez as soon as macros are involved things would clash badly and not work. works for macro-less things like clojure/string.cljs + .clj but more complex stuff like core.async would break completely.

🙏 3
Grigory Shepelev12:10:32

Hi! I had some experince with javascript (node, webpack, vuejs) and Elm. Now I'm digging into clojurescript webdev. The ecosystem looks kinda compicated for me at the first look. As far as I understood shadow-clj is like webpack. I have a freshstart project with re-frame framework. How do I use frontend css framework? For example material-components ( with hiccup?


The documentation of material-components-web says: > Simply render the necessary DOM, and attach the data-mdc-auto-init="MDCIconButtonToggle" attribute Seems like you can just follow the documentation then and simply convert all HTML they provide into Hiccup and all JS into CLJS.

Grigory Shepelev12:10:50

I don't understand. In this case I should use that with CDN? I want to have it in my bundle with npm install


Ah. Your initial question was about using it with Hiccup. :) Just follow the shadow-cljs user's guide:


hey folks, can anybody help me get the cljs compiler to watch my directory for changes and auto re-compile? I'm running clj -m cljs.main -co build.edn -O advanced -c -w ./src/ and get Assert failed: No file for namespace -w exists


Ok if I add my core namespace to the -c flag I can get a build, but it doesn't watch...

Mikko Harju13:10:36

Is there a nifty way to preserve keywords with namespaces when converting to JS datastructures and back? How about object metadata?

Mikko Harju13:10:16

I have a javascript library that needs the data in javascript format, but I'd like to be able to use the data it passses me again as CLJS data. This works fine for most things, but keyword values and object metadata is lost in this roundtrip.


Either that library has to support some metadata in some way, or you have to wrap all calls to that library with some code that remembers everything that that library doesn't support, destroys it, and recreates if after the library call is finished.

Mikko Harju17:10:47

Yeah, that’s what I thought. No way of getting around it..

Michaël Salihi14:10:58

Hi @nickt, put the watch flag after the cljs.main like this and it'll works: clj -m cljs.main -w src -co build.edn -O advanced -c

Ronny Li14:10:46

Does anyone have tips on incorporating into a Figwheel project?


Use the tailwindcss package and call it from a Makefile. As long as you set css-dirs in figwheel config, it should auto-update.

🙏 3

Also unless you modify style.css (I only have the \@tailwind directives) you won't need to re-run it, except for prod when you wish to purge unused classes. For prod you set in Makefile export NODE_ENV := production to have tailwindcss purge.

🙏 3
Ronny Li17:10:55

sorry if this question is really silly. Do you actually have a separate Makefile or are you referring to something like deps.edn or npm's package.json or Webpack?


Don't worry about it! I do have a Makefile for my own project. Here's a WIP project that has the tailwindcss boilerplate I ended up with:

🙏 3

You don't need a Makefile but I find it makes everything easier and more automated (like automatically running npm install if tailwindcss is missing).


Hi guys, does anybody know where to find the documentation for shadow-cljs-macros like "[:>" ? They are quite hard to google for.


:> is not a macro, it's a regular keyword. And it's not related to shadow-cljs - it's a Reagent thing.


Ah, guess that's why I didn't find it. Thank you very much. 🙂

👍 3