Fork me on GitHub
#clojurescript
<
2016-04-16
>
tel03:04:47

What’s the current base way to generate documentation for a clojurescript library?

sbondaryev11:04:05

is there a way to check the compilation mode in the clojurescript file?

martinklepsch12:04:18

@sbondaryev: not by default I believe but you can use :closure-defines for this kind of stuff

martinklepsch12:04:29

allows you to pass constants into the code during compile time

darwin13:04:42

@sbondaryev: alternatively you can use environmental variables and use macros to “expose” them to clojurescript code (something like this): https://github.com/binaryage/chromex/blob/master/src/lib/chromex/config.clj#L7-L14

darwin13:04:02

it is a bit more involved, but you don’t have to rely on :closure-defines, which has its own quirks

sbondaryev13:04:47

Ok thanks, I’ll consider this solutions

sbondaryev13:04:13

I prepare a lib - their code depends on compilation mode

darwin13:04:26

I see your point, I’m not aware of any existing solution, you have to ask user of your library to specify env var to indicate compilation mode for your lib

darwin13:04:56

the problem is that you would in general case want complete compiler configuration available somewhere (in env vars for my solution)

darwin13:04:23

this env-var solution is not that bad IMO, both leiningen and boot offer plugins to do that from project.clj or by other means

darwin13:04:40

lein-environ should take care of passing that to environment to chromex library

darwin13:04:03

actually I ran into issues with this solution when using lein profiles, but that is another story: https://github.com/weavejester/environ/pull/53

darwin13:04:48

I’m probably going to write my own lein-environ plugin, maybe we could think about a way how to expose complete cljs compiler environment there, but I assume you want a generic solution not dependent on build infrastructure used

sbondaryev13:04:18

Thanks, i'll look into it

darwin13:04:05

or we could try to implement a patch of cljs compiler, which would expose compiler config to macros (in clojure)

darwin13:04:32

that would the best solution, but I’m not sure if would potentially have chance to be accepted

ezmiller20:04:30

Anyone know the best way to clear a reagent atom, i.e. reset the values set on it? Something like this:

(reset! my-atom ())
?

darwin21:04:39

@ezmiller: (reset! my-atom {}) or (reset! my-atom nil) depending what is your initial state