I have tried (.exe (RegExp. ...)
too. It seems the value returned by .exe
is a malformed Javascript Array.
It has the value that looks something like this.
{0: <actual-str>, 1: <match-groups>, matches: {..}}
Now when this value is parsed by Clojurescript it thinks its an array and only returns [<actual-str>, <match-groups>]It makes sense cos Array in Javascript is an Object whos keys are numbers.
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
According to Clojurescript doc here https://clojurescript.org/tools/testing
> 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]]
[server.cljs.history_test]))
(enable-console-print!)
(defn runn []
(run-tests))
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]])
nil
cljs.user=> (runn)
Testing server.cljs.tests
Ran 0 tests containing 0 assertions.
0 failures, 0 errors.
nil
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: https://clojurescript.org/guides/ns-forms#_clojure_namespace_aliasing Edit: see now that thheller was about couple of hours faster 😄
I appreciate the link, so good that you missed Thomas’ answer. 😃
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.
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 (https://www.npmjs.com/package/material-components-web) 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.
I don't understand. In this case I should use that with CDN? I want to have it in my bundle with npm install
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...
Is there a nifty way to preserve keywords with namespaces when converting to JS datastructures and back? How about object metadata?
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.
Ah. Your initial question was about using it with Hiccup. :) Just follow the shadow-cljs user's guide: https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages
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
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.
Does anyone have tips on incorporating https://tailwindcss.com/docs/installation 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.
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.
Yeah, that’s what I thought. No way of getting around it..
Thanks!
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?
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. 🙂
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: https://github.com/uosl/dataseek
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).