This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-03
Channels
- # aws (24)
- # beginners (377)
- # calva (33)
- # cider (1)
- # circleci (22)
- # cljs-dev (7)
- # clojure (40)
- # clojure-europe (1)
- # clojure-france (9)
- # clojure-norway (3)
- # clojure-taiwan (2)
- # clojurescript (8)
- # conjure (10)
- # cryogen (2)
- # emacs (1)
- # fulcro (23)
- # helix (1)
- # hoplon (2)
- # luminus (7)
- # meander (3)
- # off-topic (2)
- # re-frame (7)
- # reagent (8)
- # reveal (38)
- # sci (13)
- # shadow-cljs (17)
- # tools-deps (17)
- # vim (1)
Using Shadow-cljs, is there a way to run a hook inside the context of the reloaded cljc source files? From my test on the hooks, it seems that the source code is only loaded once.
This is my use case: https://clojurians.slack.com/archives/C07UQ678E/p1609647836133300
scanning for generic things like that is difficult but build hooks receive the entire build state and can inspect it however they need
I took a look at the build-state
and made the mistake of printing its content 😛
the best option I have found so far however is using a dedicated css
macro or so that collects these things during compilation. much easier to extract but slightly more verbose in the code
(def button-style (css :border :p-2 :shadow :lg/p-4))
or sooh, good idea (for the tap>)
:output
has all the outputs of those sources (in :flush
) stage, otherwise might still be empty
I made a macro which adds the css in the metadata attached to the clojure var already. I am looking at how to read it from the hook.
you can take a look at this macro I wrote https://clojureverse.org/t/using-none-code-resources-in-cljs-builds/3745
you could read that out later in the build hook via [:compiler-env :cljs.analyzer/namespaces your.ns :your.thing/key]
or so
Thx, I am taking a look now.
@U05224H0W this worked !
(tap> (get-in build-state
[:compiler-env
:cljs.analyzer/namespaces
'
:defs
'my-fn
:css]))
Big thank you !