This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-01
Channels
- # announcements (2)
- # babashka (10)
- # beginners (133)
- # calva (28)
- # cestmeetup (1)
- # chlorine-clover (31)
- # cider (21)
- # clj-kondo (29)
- # cljs-dev (252)
- # clojure (60)
- # clojure-europe (24)
- # clojure-nl (3)
- # clojure-spec (13)
- # clojure-uk (17)
- # clojurescript (47)
- # conjure (20)
- # datascript (2)
- # datomic (4)
- # figwheel-main (4)
- # fulcro (71)
- # helix (16)
- # jobs (1)
- # meander (56)
- # mount (1)
- # off-topic (15)
- # pathom (25)
- # re-frame (17)
- # reagent (5)
- # remote-jobs (1)
- # shadow-cljs (92)
- # sql (10)
- # tools-deps (71)
- # xtdb (14)
If I use shadow-cljs, and I have lib A depend on NPM packageX version 1.2 and now say I have lib B depend on NPM packageX version 2.0 and now I have my app depend on both lib A and lib B? What happens? Assuming lib A and B are both ClojureScript libs?
@gmercer launching lein less
in a hook is not a good idea. :configure
is called whenever your build config changes while watch is running so you can end up with multiple watches. I recommend using some other tool to run multiple processes for you. eg. https://github.com/strongloop/node-foreman
@nathan.probst dynadoc is a leiningen plugin. not sure it can be used without lein. maybe try shadow-cljs run dynadoc.core with maybe some args
?
@didibus you have to sort out that conflict and decide which version to install. ultimately the installed version wins. if none are installed shadow-cljs will install the newest one, assuming they are declared in deps.cljs
:npm-deps
(of those libraries)
@thheller cheers, yes - a nasty hack, after investigating it looks I should use the less tool directly (rather than lein-less) and get it to run alongside/in conjuction with shadow watch app
. Do you know of an example something like that? I guess the trickiness is making sure tools run at the correct part of the lifecycle
I have never used less
in any shape so I can't make recommendations on which tools to use
I mean any other node web pipeline tool that does a transformation to directories watched by shadow
I was looking for an example of running another node tool .. that places files in shadow-cljs
's area of concern
if you configure :dev-http {3000 "public"}
which serves the public folder under port 3000
if you use a custom webserver you'll need to configure :watch-dir
, see https://shadow-cljs.github.io/docs/UsersGuide.html#_css_reloading
If I change my search from less to sass or scss .. I can see you have been through this discussion before ..
do you have the example that shows node-sass
"running in the background" or in conjunction with shadow ?
FWIW I also used https://www.npmjs.com/package/npm-run-all in the past but imho nf
is simpler and does enough for me
I don't use it to run shadow-cljs though, still run that separately. I guess mostly out of habit
I was trying to get a beginner started with the re-frame template (which uses lein to kick-off shadow-cljs) and trying to avoid the extra lein less auto
step, if I can work it out I would create a PR to make it easier for other beginners.
that is a question for the template then, I have no control over that and my own grievances with the setup it creates
I could take that the wrong way ... are you going to make a proper shadow-cljs only re-frame template :rolling_on_the_floor_laughing:
I made a clj-new template for re-frame/shadow-cljs/deps.edn projects, might need its dependencies updated, but I’ve been using it https://github.com/omnyway-labs/re-frame-template
There is already an issue to improve the integration storey between shadow-cljs and re-frame-template @gmercer Please see https://github.com/day8/re-frame-template/issues/128#issuecomment-634414469 Busy working on some documentation related issues atm but will get to this at some point in the near future.
@U0G75S29H sounds great - looking forward to it
I don't use re-frame so I won't create a template for it. thats a community thing, there are already plenty of templates that just use shadow-cljs directly without the whole lein-shadow
setup
I was just familiar with that template and using lein was fine, they added the shadow-cljs feature and I thought I would check it out .. I might see if I can find a pure shadow-cljs template ... didn't even think of that 😉
the official re-frame-template is definitely the best maintained and has the most options though
even though they just plonked shadow-cljs on as an option, it should really cope with the other chosen options
PS I just read your clojure-verse discussion on shadow-cljs templating .. now I need to check out vue cli to see what you mean
Hello! I'm using shadow-cljs
for web project. I have macros, which in the meantime should read from
. With shadow-cljs
, how do I configure the resources path?
Check the :source-paths
key (or src
if you're using deps.edn
)
https://shadow-cljs.github.io/docs/UsersGuide.html#source-paths
Yes thanks. Only it's not :resource-paths
Hey I have 2 build entries, how would I point a (second?) dev server to the other out dir?
:dev-http {8080 "target/"}
:builds {:app {:output-dir "target/"
:asset-path "."
:target :browser
:modules {:main {:init-fn }}
:devtools {:after-load !
:preloads [devtools.preload]}}
:devcards {:output-dir "devcards/"
:asset-path "."
:target :browser
:modules {:main {:init-fn devcards.main/init}}
:devtools {:after-load !
:preloads [devtools.preload]}}}
✗ npx shadow-cljs browser-repl
<...>
cljs.user=> .1
------ WARNING - :undeclared-var -----------------------------------------------
Resource: :1:1
Use of undeclared Var cljs.user/
--------------------------------------------------------------------------------
0.1
cljs.user=>
Having this error. Should this be a warning?
Hey, I'm struggling a bit with devcards, given the following:
(ns devcards.main
(:require-macros
[devcards.core :refer [defcard]])
(:require [reagent.core :as r]
[devcards.core :as dv]))
(def functional-compiler (r/create-compiler {:function-components true}))
(reagent.core/set-default-compiler! functional-compiler)
(defn hello-component []
[:div "hello-world"])
(defcard hello
(r/as-element [hello-component]))
(defn ^:export init [] (devcards.core/start-devcard-ui!))
(defn ^:export reload []
(println "Refreshing Devcards!"))
I get
main.js:2232 TypeError: Cannot read property 'start_devcard_ui_BANG__STAR_' of undefined
./cljs-runtime/shadow.module.main.append.js:4 An error occurred when calling (devcards.main/init)
eval @ ./cljs-runtime/shadow.module.main.append.js:4
goog.globalEval @ main.js:836
env.evalLoad @ main.js:2229
(anonymous) @ main.js:2411
main.js:2231 An error occurred when loading shadow.module.main.append.js
env.evalLoad @ main.js:2231
(anonymous) @ main.js:2411
main.js:2232 TypeError: Cannot read property 'start_devcard_ui_BANG__STAR_' of undefined
at Object.devcards$main$init [as init] (main.cljs:18)
at eval (./cljs-runtime/shadow.module.main.append.js:4)
at eval (<anonymous>)
at Object.goog.globalEval (main.js:836)
at Object.env.evalLoad (main.js:2229)
at main.js:2411
[:devcards] Build failure:The required namespace "devcards-marked" is not available, it was required by "devcards/util/markdown.cljs".
seems like the new version relies on some bundled marked dependency. shadow-cljs doesn't support foreign libs so that won't work
you can probably set :js-options {:resolve {"devcards-marked" {:target :npm :require "marked"}}}
to "correct" it
Hello, I'm trying to run some tests using Karma
But I keep getting shadow is not defined
I followed the instructions here
sounds like you didn't. this happens if the code produced by shadow-cljs isn't actually included in the code loaded by karma
yes, I saw this thread here in the history, the path seems right
:output-to "target/ci.js"
must match the
basePath: 'target',
// The file itself
files: ['ci.js'],
it worked now, I think it was because I didn't add --single-run
I made a clj-new template for re-frame/shadow-cljs/deps.edn projects, might need its dependencies updated, but I’ve been using it https://github.com/omnyway-labs/re-frame-template