Coder Social home page Coder Social logo

Comments (3)

genmeblog avatar genmeblog commented on May 17, 2024 2

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).

from clerk.

genmeblog avatar genmeblog commented on May 17, 2024 1

Works!

from clerk.

mk avatar mk commented on May 17, 2024

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 html viewer like so:

^{: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 👋"]])

Screen Shot 2022-02-02 at 10 22 00

Please let me know if that works for you.

from clerk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.