This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-15
Channels
- # announcements (20)
- # babashka (281)
- # beginners (13)
- # biff (8)
- # calva (20)
- # cider (5)
- # clj-commons (1)
- # clojure (46)
- # clojure-boston (1)
- # clojure-europe (6)
- # clojure-losangeles (24)
- # clojuredesign-podcast (3)
- # clojurescript (12)
- # datomic (1)
- # events (1)
- # fulcro (12)
- # guix (2)
- # honeysql (1)
- # integrant (1)
- # introduce-yourself (1)
- # rdf (16)
- # reagent (3)
- # reitit (14)
- # releases (3)
- # sci (28)
- # shadow-cljs (122)
- # specter (1)
- # tools-deps (10)
- # xtdb (6)
A question about the tailwind integration - am I correct in reading the code that tailwind is only going to process HTML from anything listed under the :static
key on the features
map? That is, if I return some HTML snippet from a handler listed under :routes
, any tailwind classes used won't get compiled?
Are you defining new tailwind classes in resources/tailwind.css
, for example .btn
and .btn-secondary
here? https://github.com/jacobobryant/platypub/blob/62c8d46989c96b4ce064d26bb9721576017a37da/resources/tailwind.css#L28
They get compiled and are available throughout, I believe.
See also how to add custom styles in resources/tailwind.config.js
if you're creating completely new styles :
https://tailwindcss.com/docs/adding-custom-styles
No, nothing custom so far (though that would be a workaround I suppose). Just want to confirm that I'd need to somehow inform tailwind of any classes being used outside of :static
the wheels are turning in my head about some macro that wraps any html, in production it just evaluates back into e.g. a def
but in dev mode it registers any elements/classes it sees and spits them all out into a file that can be shown to the tailwind compiler
Tailwind will read all code, not just code included under :static. see this line: https://github.com/jacobobryant/biff/blob/3ed303c1d5f26eef54f1561404e6e226c7978347/example/resources/tailwind.config.js#L3 tailwind doesn't parse the Clojure code, it just uses regex to look for classes within any files in the src directory.
an implication of that is that you shouldn't do something like [:div {:class (str "text-" "red")} "hello"]
because it would break the regex
Oh, excellent! I was misunderstanding then, I thought tailwind made links between elements and the classes they used, e.g. "I see a <p>
using someClass
so I need to emit p.someClass
. Glad to hear it's more general than that. Thanks!
you're welcome!