This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (26)
- # babashka (1)
- # beginners (174)
- # calva (1)
- # cider (10)
- # clj-kondo (27)
- # cljtogether (1)
- # clojars (8)
- # clojure (57)
- # clojure-australia (1)
- # clojure-czech (2)
- # clojure-europe (40)
- # clojure-germany (15)
- # clojure-nl (3)
- # clojure-serbia (6)
- # clojure-uk (11)
- # clojurescript (30)
- # conjure (2)
- # cursive (8)
- # datalog (16)
- # datomic (29)
- # emacs (33)
- # etaoin (1)
- # events (2)
- # fulcro (81)
- # funcool (2)
- # integrant (3)
- # jobs (2)
- # joker (2)
- # kaocha (15)
- # lsp (19)
- # malli (8)
- # membrane (1)
- # off-topic (57)
- # pathom (2)
- # reitit (10)
- # releases (1)
- # remote-jobs (2)
- # reveal (5)
- # shadow-cljs (14)
- # sql (11)
- # tools-deps (8)
- # vim (3)
So, bit of an odd question: I’d like to use https://clojureverse.org/t/best-practices-for-importing-raw-text-files-into-clojurescript-projects/2569 (a macro that uses
slurp) to inline a big JSON file into a cljs project. The inlining macro part works fine, but I’d also like to parse the file from JSON into clojure data structures/EDN at compile-time. That requires an external dependency, but only for clojure (not clojurescript) and only at compile-time. Is there a way to specify clojure compilation dependencies separately from clojurescript dependencies? A lot of the clojure JSON parsers rely on Java libraries and I suspect things would get mad if I specified them as normal clojurescript dependencies. I’m using shadow-cljs (I think that matters?)
So I just mix it in with my normal clojurescript dependencies and everything will figure itself out?
If something somehow blows up, it would likely deserve a minimal reproducible example shared in #shadow-cljs
FWIW you should absolutely avoid inlining larger files into a build this way. the source compiled variant of edn will be much larger than the original edn and bloat your bundle size. ideally load data at runtime instead.
Depends on the use case also. Browsers have not been mentioned so it might be a toaster.
Good to know! In this particular case, I’m trying to create a single-html-file application to ease distribution of an application and I’m not actually serving it over the web, so size isn’t much of a concern. But it’s good to know that EDN compiles larger than the equivalent string. Thanks for the tip!
Are there any resources I can look at for how to integrate Clojurescript into a pre-existing JS codebase?
Am doing a ClojureScript project for my final year project and will be discussing with my ex-colleague (doing my capstone project with a company I interned at) , how the integration pathway might be like if our work is something they want to integrate back into their js codebase
I don't have any personal experience doing that. If you're not using shadow-cljs, consider using it, and then this link could be useful: https://shadow-cljs.github.io/docs/UsersGuide.html#target-npm-module
How do I convert the lein template like
lein new reagent myproject from lein-figwheel to figwheel-main ?
Also, does it make sense to use shadow-cljs as a compilation target and figwheel main as the repl type? I don't really understand where shadow fits into this
no, you use either shadow-cljs or figwheel. not both. shadow-cljs also provides repl and hot-reload and so on
@zackteo - It would be easier to create project first then add figwheel-main as described in it's documentation.
I found a message on the google group talking about this, but what is suggested seems to have no effect.
Oh :o right. Might something like this be a good starting point then ? https://github.com/lauritzsh/reagent-shadow-cljs-starter
Or maybe this https://github.com/jacekschae/shadow-reagent just that I should remove the
proto-repl dependency :thinking_face: cause im using cider and my friends are using calva
I find templates often just lead to more trouble because then I don't understand the build at all.
agreed. I think everyone should go through a quickstart like tutorial at least once. be it cljs, figwheel or https://github.com/thheller/shadow-cljs#quick-start
getting to know the parts involved is essential and templates often invite you to skip those parts just to get you going a little quicker. which in the long run isn't ideal IMHO