Skip to content
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

tailwind #596

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

tailwind #596

wants to merge 1 commit into from

Conversation

mbostock
Copy link
Member

Some things to figure out:

  1. Tailwind has very opinionated “preflight” styles which are essentially incompatible with Markdown. (For example, paragraphs have no margins by default, and so smush together.) We’ll need to either disable these preflight styles completely, or add our own base styles for margins on paragraphs and headings, or change our Markdown generator to apply the appropriate Tailwind styles explicitly.

  2. It seems like for preview we can use Tailwind’s CDN script. But it would be better if this were self-hosted, given that we’ve already installed Tailwind locally; we want the preview server to work offline. Maybe we could use the Tailwind CLI instead, and watch files, but then we’ll also need to update the stylesheet as the content changes. Overall, I think it’ll be a fair amount of work to get live preview working.

  3. For build, presumably we can use Tailwind’s CLI, so that doesn’t seem too bad. I was imagining that Tailwind would be an observablehq:tailwind.css module.

  4. Users might need some way to configure Tailwind. Ideally, the Tailwind config is nested within the Observable config. This is all predicated on us being able to invoke Tailwind programmatically, which it doesn’t seem set up to do, but presumably we can do it using PostCSS and loading Tailwind as a plugin. 😓

Ref. #595.

@mbostock
Copy link
Member Author

As an alternative for disabling preflight, there is also a prose class in the typography plugin that is intended for Markdown.

@mbostock mbostock mentioned this pull request Jun 9, 2024
@tgy
Copy link

tgy commented Jun 9, 2024

I think the prose plugin is the right way to go! Maybe we could also dynamically add tailwind classes to the HTML elements generated from the Markdown code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants