Fork me on GitHub
#shadow-cljs
<
2018-02-19
>
eoliphant03:02:44

hi, I have an existing leiningen project that I’d like to convert to use shadow-cljs, I haven’t been able to find much in the way of complete examples online, and i’ve not quite figured it out from the docs, does anyone know of any more or less complete lein integration examples?

thheller08:02:54

@eoliphant "lein integration" only means that the :source-paths and :dependencies are configured via lein. All build configs will still be in shadow-cljs.edn. So you only need to set :lein true in your shadow-cljs.edn. As far as builds they are identical whether or not you use lein.

thheller08:02:45

eg. in this example https://github.com/shadow-cljs/quickstart-browser/blob/master/shadow-cljs.edn you just set :lein true and move :dependencies and :source-paths to project.clj.

thheller08:02:22

I guess you must also add [thheller/shadow-cljs "2.1.21"] though

eoliphant13:02:47

ok @thheller thanks will check that out, so also, I take it I need to comment out my existing :cljsbuild keys in my project.clj?

thheller13:02:29

not required no

thheller13:02:39

you should probably remove cljsbuild and figwheel from the plugins though. also not required but they will load a couple deps that shadow-cljs won't use

thheller13:02:24

you might end up with a couple of conflicts. to be sort of safe include these deps first.

thheller13:02:26

[[org.clojure/clojure "1.9.0"]
 [org.clojure/clojurescript "1.9.946"]
 [thheller/shadow-cljs "2.1.21"]]

thheller13:02:12

core.async is one common offender if you use an older version

thheller13:02:52

running standalone without lein won't have these conflicts so thats what I usually recommend

eoliphant13:02:58

ok will try that. Also, based on my reading, i need to pull out any cljsjs refs. I’m using reagent, etc. So would it just be a matter of adding exclusiions to the reagent dependencies, and pulling in the right react version, etc via npm?

eoliphant13:02:32

yeah i saw the note that standalone is cleaner

thheller13:02:33

thats mostly taken care of already. you just need to manually npm install react react-dom create-react-class for reagent

thheller13:02:04

generally if it tell you that is can't find a JS dependency you need to npm install it

thheller13:02:18

since we aren't using cljsjs but rather npm directly

eoliphant13:02:39

but i’d need to say exclude react from my reagent dependency, to keep it from getting pulled in that way?

thheller13:02:58

you can but you don't have to. it won't be used either way.

eoliphant13:02:28

because in this case i’m not running the cljsbuild

eoliphant13:02:58

ok thanks for your help will give this a whirl

hlolli13:02:31

@eoliphant What I'm doing now, is to do all the server side clj stuff with lein, and serve the js-poutput directory with html, and when shadow-cljs is being run with watch, the hot reload works auto*magic*ally

thheller13:02:32

feel free to ask questions. helps me write a "migrating from cljsbuild" chapter for the docs 😉

eoliphant13:02:19

that would be great, i was thinking about figuring out how to add this config as a luminus profile at some point

martinklepsch15:02:18

Does shadow-cljs provide a way to load :none builds in Nashorn?

thheller15:02:45

@martinklepsch I haven't done any serious nashorn work so no it doesn't.

thheller15:02:20

my conclusion so far has been that if you want to run clojurescript in nashorn you should just use clojure instead 😛

thheller16:02:14

what is your use-case? I'm curious what all the nashorn hype is about.

martinklepsch16:02:03

Agree that just running Clojure is probably preferable, was just evaluating options for server side rendering