-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom CSS replaces existing one instead of enhancing it. #67
Comments
Actually, replacing the full stylesheet is actually the intended usage. Clerk currently uses tailwind 3's play cdn. This is a javascript script that generates the used classes on-demand (using a mutation observer on the dom). This is primarily intended as a dev affordance. When publishing in production, tailwind recommends to compile a custom stylesheet containing only the used classes. So we have this abstraction as a way for a user to override the stylesheet, compile it with a different tailwind config or user-appended styles (that can again include the viewer.css) but after going down that road we realized we don't want to be in the business of running a css pipeline for folks. Also note that you can add inline styles using the ^{:nextjournal.clerk/visibility :hide-ns}
(ns style-tag
(:require [nextjournal.clerk :as clerk]))
^{::clerk/viewer :html ::clerk/visibility :hide}
[:style ".my-custom-class { color: blue; background-color: red; border-radius: 5px;}"]
(clerk/html [:div.my-custom-class.p-2 [:h1 "Hello 👋"]]) Please let me know if that works for you. |
Thank you, above solution sounds as a reasonable one. I think this is exactly what I need (inline CSS for a couple of custom classes). Need to try that still (be back soon with conclusions). |
Works! |
Calling below:
(swap! config/!resource->url assoc "/css/viewer.css" "notebooks/custom.css")
works as (probably) intended. However I don't think anyone wishes to build complete CSS for Clerk from the scratch. I think typical use case would be just to add/replace some (small) CSS subset. A couple of classes/ids.
What do you think?
The text was updated successfully, but these errors were encountered: