This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-20
Channels
- # beginners (35)
- # boot (81)
- # braveandtrue (7)
- # cider (74)
- # cljs-dev (52)
- # cljsrn (5)
- # clojure (114)
- # clojure-austin (1)
- # clojure-belgium (3)
- # clojure-brasil (8)
- # clojure-czech (7)
- # clojure-greece (18)
- # clojure-ireland (1)
- # clojure-russia (67)
- # clojure-uk (11)
- # clojurescript (52)
- # core-async (5)
- # core-matrix (3)
- # cursive (13)
- # data-science (3)
- # datomic (8)
- # emacs (80)
- # events (2)
- # hoplon (8)
- # immutant (7)
- # jobs-discuss (3)
- # juxt (25)
- # ldnproclodo (21)
- # leiningen (27)
- # mount (24)
- # off-topic (6)
- # om (23)
- # onyx (48)
- # parinfer (1)
- # proton (4)
- # re-frame (41)
- # reagent (9)
- # spacemacs (8)
- # untangled (122)
Is it ok to have a clj/app/config.clj
file and a cljs/app/config.cljs
file, both of which start with (ns app.config …
? Will Clojure and ClojureScript know that these are totally unrelated or will the functions in the two files live in the same namespace and cause problems?
@fasiha: Ignoring macros for now, you will have no issues with having two files with the same ns, one with .clj
and one with .cljs
. The Clojure reader looks for it’s ‘native’ extension first (`.clj`, .cljs
), then to cljc
if it can’t find it.
There is no way (that I know of) for Clojure or ClojureScript to have functions in both files’s loaded at the same time
Thanks @danielcompton! Clojure just makes life easy
@lewix: I don't have a direct answer, but I'll describe what I did because I had a rough experience with googling "clojurescript tutorial". I went through @bhauman's https://github.com/bhauman/lein-figwheel/wiki/Quick-Start, then went through several React.js JavaScript tutorials and porting them to ClojureScript/sablono. Plus a lot of googling for various things as they came up… probably not the most time-efficient method 😕
what is the recommended way of making reagent components that take optional parameters with default values? aka defaultProps in react
@bojan.matic Not that I know of; I have rolled my own thing for this.
(I try not to write too many macros but I found myself writing stuff for default arguments over and over again)
perhaps i misspoke, i didn’t mean optional as much as i meant default - so, parameters that always need to be provided but you can set a sensible default and skip it most of the time
how do you use this macro?
(defn foo-component [{:keys [:awesome? :style]
:or {:awesome? true, :style {:overflow "scroll"}}
:as params}]
; Code goes here
)
That will set awesome?
to true
by default, and create a default style (but you should really use CSS, this is bad practice)
My thing is basically the same instead you write defnp
instead of defn
, and when you are actually writing your hiccup out you can write [foo-component]
and it behaves the same as [foo-component {}]
oh, i see
thanks
i saw {:keys} a few times in examples, but never knew how it really works…does it set missing keys to nil? I see it described as a “directive”, what’s a directive?
The other directives are :strs
and :syms
but I've honestly never used those nor seen them used
Is there a way to force a clojurescript file to be recompiled when a macro it uses changed? The macro is in another jar.
Yes, using lein. Does a version ending in "-SNAPSHOT" mean the dependency always gets a fresh copy from the repo?
checkouts accelerates this even more, though, since it means you won’t even need to reload things like repls or figwheel or autobuilders
Checkouts means I need the source of both projects on my local machine (for the symbolic links). That may be a problem for my configuration.
what do you guys use to log things that happen on the client? one solution would be an HTTP endpoint that appends to a flat file. is there any reason to go more advanced than that?
has anyone found a good way to get third-party library css into your clojurescript bundle?
because if so, I’ll use http://webjars.org + boot with something like this (sift :add-jar {'org.webjars/font-awesome #"css/.+\.css$”})
to add the file to my bundle