Fork me on GitHub
T M00:06:14

excuse me. i want to use bootstrap. is there any bootstrap for cljs library i can use? thanks


I don't think you'd need a library around bootstrap?

max minoS04:06:37

I have a .json file in the same directory as my clojurescript file, how do I import that .json and convert it into a clojure object?


I would write a clojure macro which can load and parse the json.

max minoS05:06:16

should I just convert the entire json into a clojure object

max minoS05:06:35

i was initially going to put the JSONs as a gist that I can GET using cljs-ajax (which I think can parse the JSON), but then I thought that it's probably even better if i can just import the JSON in the same source directory


You can, although the macros still needs to return valid clojurescript code. It might be easier to return (js->clj (.parse js/JSON "..."))

max minoS05:06:02

how do I import the JSON file in the first place?


(defmacro load-json [file]
  `(js->clj (.parse js/JSON ~(slurp file))))


☝️ is a more complete solution


But the idea is that you use the jvm to load the file as a string and parse the json in the javascript runtime via interop

🙏 3

You can also leverage if you want to load a file from the classpath, like in a jar 👌


(defmacro load-resource-json [file]
  `(js->clj (.parse js/JSON ~(slurp ( file)))))


if you're using shadow-cljs, you can just use shadow.resource/inline without creating your own slurp and worrying about compilation reload stuff yourself

👀 2
Brice Ruth22:06:24

qq: I'd like to use speclj in a cljs project ... is it possible to just use node as the test runner, instead of phantomjs? Is there a better alternative for BDD/TDD style tests in cljs these days, since speclj saw it's last release in 2016, it seems?