This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-03
Channels
- # announcements (3)
- # beginners (114)
- # calva (42)
- # cider (90)
- # clj-kondo (3)
- # cljsrn (6)
- # clojure (40)
- # clojure-conj (4)
- # clojure-dev (3)
- # clojure-europe (4)
- # clojure-italy (3)
- # clojure-nl (4)
- # clojure-quebec (1)
- # clojure-spec (3)
- # clojure-uk (130)
- # clojurescript (31)
- # cursive (3)
- # data-science (3)
- # datavis (1)
- # datomic (5)
- # dirac (3)
- # fulcro (16)
- # jobs (1)
- # joker (6)
- # music (5)
- # off-topic (14)
- # re-frame (19)
- # remote-jobs (8)
- # shadow-cljs (37)
- # slack-help (4)
- # tools-deps (22)
- # xtdb (8)
Does anyone have advice on writing multiple shadow-cljs libraries for use in Javascript? Our application was at one time fully CLJS and in one project. Now due to business reasons the company is writing more pure Javascript libraries. We are using shadow-cljs to utilize our previous code in a JS ecosystem. However, I personally do not want to get rid of CLJS, so if I can use shadow-cljs to write libraries that can be used in Javascript (which it appears I can) I'd be ecstatic. However, before I go and write a bunch of libraries with Shadow CLJS I was wondering if I should take into account things like Clojure's Core being included multiple times, etc?
@kasuko writing mulitple libraries in CLJS and including them in a regular JS builds is not a good idea
what you can do is create a :npm-module
build that outputs all CLJS you want to use in the JS build
Is it possible to do some kind of code-splitting with that? For example if I build an authentication library I want to be able to provide that without including every libary
but CLJS in general is not great for writing JS libraries. :advanced
optimizations really aren't suited for that
Can shadow-cljs replace Lumo for writing shell scripts? Since you can call node your_output_cljs.js
?
@neo2551 depends. :node-script
is meant to build scripts which you can run later yes
but the edit -> compile -> run delay makes it impractical if you just want some ad-hoc scripting
but once the output is built it'll be faster than lumo since it doesn't have to load the compiler first
Hum... I usually shadow-cljs watch app when I am writing my script :)
(I just avoid to call the side effects part haha)
yeah thats fine. but you still have to run shadow-cljs first (which takes some time to start)
But once it is built, the output would have be optimal with node?
Yep, perfect! (You should totally sell this as cool feature) :)
as a recent user of this feature i'm curious whether the resulting js would be dependent on the installed node version.
thanks -- so it seems like recompilation might be necessary when using with different node environments
ah, right, as you said the product is just a js file so if node's behavior changes, that potentially affects all js files regardless of where they originate. thanks for the deconfusion.
Hell, i don’t understand shell scripts
As a very new person to Shadow-cljs, I was wondering where I could find a tutorial or guide on setting up a project with deps.edn, clojure cli, shadow-cljs and re-frame. Is there one that exists?
Story so far: 1. Install NPM 2. Install shadow-cljs 3. Install clojure cli 4. Copy deps.edn from https://github.com/Day8/re-frame/blob/master/deps.edn 5. shadow-cljs init 6. npm init
well it’s not exactly what you asked for but Fulcro3's new template is a full CLJS SPA with all of the build tools above, just with Fulcro3 instead of re-frame: https://github.com/fulcrologic/fulcro-template
Thanks I will take a look! As a beginner its hard to compare and contrast the available options
sure thing, I would start with fulcro3 today, having developed multiple apps with re-frame, it’s way more framework-y, but it provides way more in return. See the docs for further info: http://book.fulcrologic.com/fulcro3/
well it’s not exactly what you asked for but Fulcro3's new template is a full CLJS SPA with all of the build tools above, just with Fulcro3 instead of re-frame: https://github.com/fulcrologic/fulcro-template
the setup part is free https://www.jacekschae.com/learn-re-frame-free
Thanks! I really like his courses (and purchased the reagent one), I was just trying to build up a list of steps to bootstrap up to his first lesson
ie it already starts with https://github.com/jacekschae/learn-re-frame-course-files/blob/master/increments/03-dev-setup/shadow-cljs.edn
I guess you can use some of the templates like https://github.com/Day8/re-frame-template
as a recent user of this feature i'm curious whether the resulting js would be dependent on the installed node version.