This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-12
Channels
- # adventofcode (112)
- # architecture (1)
- # beginners (55)
- # boot (26)
- # cider (19)
- # cljs-dev (19)
- # cljsjs (1)
- # cljsrn (7)
- # clojure (140)
- # clojure-android (3)
- # clojure-austin (3)
- # clojure-china (3)
- # clojure-gamedev (1)
- # clojure-greece (43)
- # clojure-spec (75)
- # clojure-sweden (5)
- # clojure-uk (21)
- # clojurescript (66)
- # core-async (2)
- # core-logic (1)
- # cursive (63)
- # datascript (5)
- # datomic (4)
- # devcards (2)
- # duct (13)
- # editors (5)
- # emacs (9)
- # figwheel (4)
- # fulcro (42)
- # graphql (25)
- # immutant (7)
- # jobs (29)
- # leiningen (13)
- # lumo (7)
- # numerical-computing (3)
- # off-topic (22)
- # om (2)
- # onyx (25)
- # pedestal (3)
- # re-frame (14)
- # reagent (20)
- # remote-jobs (1)
- # ring-swagger (3)
- # rum (12)
- # shadow-cljs (9)
- # uncomplicate (1)
- # unrepl (6)
bad docs though, I learnt most of its features by asking thheller with GitHub issues or even privately on Slack
Greetings, Is there a Rum channel or this channel include of it š ?
@tonsky: thank you "creator" š
Hey all... I'm trying to add a react library/component to a cljs/re-frame project. This is how far I got now:
in project.clj
:
:compiler {...
:install-deps true
:npm-deps {"react" "16.2.0"
"react-flatpickr" "3.6.3"}}}
That seems to work fine (starting lein figwheel dev
results in a new directory node_modules
, so it seems the deps are downloaded.In my namespace where I want to add the component:
(:require ...
["react-flatpickr" :as flatpickr]
No error, so it means it is somehow recongized. But now I'm stuck...I can't seem to do anything with flatpickr
@kurt-o-sys why not use cljsjs
search https://cljsjs.github.io/ for flatpickr and it includes usage instructions. Also see https://lambdaisland.com/episodes/javascript-libraries-clojurescript
because that react component is not there
It has flatpickr, not react-flatpickr.
I tried to make a reagent component, but failed so far. However, since the react component already exists, I thought it would be fairly straight forward to import it... š
http://reagent-project.github.io/docs/master/reagent.core.html#var-adapt-react-class
Well, I can't find react-flatpickr
in the cljsjs libs.
(Also, I thought it would be straight forward to add existing react components to reagent, and I feel I'm really close, but I'm not sure what I'm overlooking)
right... I saw it like that somewhere (and it's the closest I've been - i.e. no warnings or errors š ).
But I can try again doing it differently. So, you mean I have to use (js/require ...)
, right?
but see this: https://github.com/lambdaisland/thirdpartyjs/blob/cljsjs-d3/src/cljs/thirdpartyjs/core.cljs
I saw the video's, I'm busy for about 2 days trying all these things to make it work, and I can't make it work... If anyone can walk me through this or help me out, that would be nice.
This is what I followed last: https://clojurescript.org/news/2017-07-12-clojurescript-is-not-an-island-integrating-node-modules
So silly question but, how can I require my npm deps in cljs ? I have found a doc but itās not working. https://clojurescript.org/news/2017-07-12-clojurescript-is-not-an-island-integrating-node-modules What have I miss ?
that's exactly my question š
np...
I can't make it work properly either.
it seems people don't seem to know š.
@scknkkrer nope, it's not...
some libs are already packaged- http://cljsjs.github.io this predates https://clojurescript.org/news/2017-07-12-clojurescript-is-not-an-island-integrating-node-modules (havenāt had a chance to try it yet)
ānot workingā is a bit vague though? I mean there are probably people in this channel that could help given more information
right... agreed. What should we try first? (That may be faster, than retrying what we/I tried already) It's about adding an existing npm module to a cljs project.
Never used it myself. But you have the latest clojurescript stable, :npm-deps
, maybe :install-deps
and no compiler error?
well, I don't have a compiler error using :npm-deps.
that seems to work fine (different node_modules
are installed)
just not sure how to proceed afterwards ["react-flatpickr" :refer [Flatpickr]]
doesn't give any compile time error
but I can't seem to use it.
so it may be better to do it the other way: can someone explain how to add external npm modules to a project?
well, did that before, until someone told me to put :refer
š
@kurt-o-sys :refer and :as are allowed together, I only suggested :refer because thatās how your working example was doing it
right... I know they are allowed together. I'm just wondering if there's a step by step guide somewhere. I haven't found one that works yet.
I just update my figwheel dep and it worked for left-pad dep. But react-markdown still doesnāt work.
@scknkkrer something like this:
:devcards {:source-paths ["src/cljs" "src/cljc" "env/dev/cljs"]
:figwheel {:devcards true}
:compiler {:main "ui-app.cards"
:asset-path "js/devcards_out"
:output-to "target/cljsbuild/public/js/app_devcards.js"
:output-dir "target/cljsbuild/public/js/devcards_out"
:source-map-timestamp true
:optimizations :none
:pretty-print true
:install-deps true
:npm-deps {:react-flatpickr "3.6.3"}}}
?(I changed the string with a keyword now, just trying all kinds of stuff, all things that are scattered around the internet :p)
if i have figwheel going and i add a dependency to project.clj
, do i need to restart figwheel to have that dependency available?
thatās been my experience, yes
The underlying mechanism is that by adding a dependency you essentially need to add a new JAR to the classpath.
While there are ways to try to do this without restarting, the straightforward solution is to stop and start a new JVM with the new classpath.
Iām looking for a large-ish real-world OSS ClojureScript projects. Any pointers? (large-ish ~= dozens of files / thousands of lines)
Does it need to be OSS? I've got 22k lines of SPA using re-frame which has a few years development by a small team.
So long as it remains private and our client can see possible benefits (to the community) I can probably share a snapshot.
(last time we shared was with the re-frame guys who we thought might be interested in seeing our "scale" pain points)