Fork me on GitHub

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? 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 :


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

Jacob O'Bryant17:05:29

Tailwind will read all code, not just code included under :static. see this line: tailwind doesn't parse the Clojure code, it just uses regex to look for classes within any files in the src directory.

Jacob O'Bryant17:05:01

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!

🙂 1
Jacob O'Bryant17:05:51

you're welcome!