feat: generate our own tailwind stylesheet#26
Open
mtamc wants to merge 1 commit intohaskell-miso:mainfrom
Open
feat: generate our own tailwind stylesheet#26mtamc wants to merge 1 commit intohaskell-miso:mainfrom
mtamc wants to merge 1 commit intohaskell-miso:mainfrom
Conversation
SUMMARY This commit removes `assets/styles.css` from version control, instead generating it as a part of the `build` command inside `Makefile`. The standalone tailwind CLI is already a part of the Miso wasm dev shell, so `nix develop .#wasm --command bash -c "make"` or `nix develop .#wasm --command bash -c "make build"` will work for all devs with nix installed. This will have many benefits, such as supporting tailwind settings (note as of tailwind v4, a tailwind config file is no longer mandatory, so I didn't bother adding one in this commit.), and supporting custom values e.g. `text-[14px]`, beyond the ones that were coincidentally already generated by the stylesheet we previously copied over from the basecoat docs repository (https://github.com/hunvreus/basecoat/blob/main/docs/src/assets/styles.css). TODO This commit DOESN'T add tailwind stylesheet generation as a part of the live development server initializing or reloading. This is because I was not able to run the live development server at all. For future reference, I wrote notes on how to run the tailwind CLI before starting the `miso-sampler` development server and on reload in issue haskell-miso#25: haskell-miso#25 (comment) (Note `miso-sampler` seems to use a different live development server setup from `miso-ui`.) CODE COMMENTARY The input CSS file is located at `lib/tailwind-input.css`. It is not intended to be a publicly-served file which is why I chose the `lib` directory for it. Relevant documentation on how tailwind class detection and file sourcing works: https://tailwindcss.com/docs/detecting-classes-in-source-files The default behavior is to look at every file with the input CSS file's location (`lib/tailwind-input.css`) as root. I chose to explicitly register every directory to look for classes in: `lib client shared server`. Note that class-detection is a language-agnostic process, so it scans Haskell files just fine. `lib/tailwind-input.css` imports the basecoat stylesheet, as instructed by the basecoat docs (https://basecoatui.com/installation/). I've copypasted from https://github.com/hunvreus/basecoat/blob/main/src/css/basecoat.css and into `lib/basecoat.css`, which seems to be the standard way to import basecoat without using a JavaScript package manager. It is important to note that this CSS file is NOT the same as the basecoat DOCS stylesheet (https://github.com/hunvreus/basecoat/blob/main/docs/src/assets/styles.css) which we previously used instead of generating our own, and therefore could cause unintended visual regressions from e.g. using non-tailwind classes or variables that the basecoat docs stylesheet used. From my quick manual test, it looked like the only missing rules were the theme declaration blocks (Claude, Cosmic, Tangerine, Supabase), so I've included them in `tailwind-input.css` as well. Note the miso-ui themes Cosmic and Tangerine aren't in the latest basecoat docs themes, I don't know where they originally come from. Regardless, I've copied them over.
6cd7082 to
4629eff
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #25
SUMMARY
This commit removes
assets/styles.cssfrom version control, instead generating it as a part of thebuildcommand insideMakefile. The standalone tailwind CLI is already a part of the Miso wasm dev shell, sonix develop .#wasm --command bash -c "make"ornix develop .#wasm --command bash -c "make build"will work for all devs with nix installed.This will have many benefits, such as supporting tailwind settings (note as of tailwind v4, a tailwind config file is no longer mandatory, so I didn't bother adding one in this commit.), and supporting custom values e.g.
text-[14px], beyond the ones that were coincidentally already generated by the stylesheet we previously copied over from the basecoat docs repository.TODO
This commit DOESN'T add tailwind stylesheet generation as a part of the live development server initializing or reloading. This is because I was not able to run the live development server at all. For future reference, I wrote notes on how to run the tailwind CLI before starting the
miso-samplerdevelopment server and on reload in issue #25: click(Note
miso-samplerseems to use a different live development server setup frommiso-ui.)CODE COMMENTARY
The input CSS file is located at
lib/tailwind-input.css. It is not intended to be a publicly-served file which is why I chose thelibdirectory for it.(Relevant documentation on how tailwind class detection and file sourcing works.)
The default behavior is to look at every file with the input CSS file's location (
lib/tailwind-input.css) as root. I chose to explicitly register every directory to look for classes in:lib client shared server. Note that class-detection is a language-agnostic process, so it scans Haskell files just fine.lib/tailwind-input.cssimports the basecoat stylesheet, as instructed by the basecoat docs. I've copypasted from hunvreus/basecoat/blob/main/src/css/basecoat.css and intolib/basecoat.css, which seems to be the standard way to import basecoat without using a JavaScript package manager. It is important to note that this CSS file is NOT the same as the basecoat DOCS stylesheet which we previously used instead of generating our own, and therefore could cause unintended visual regressions from e.g. using non-tailwind classes or variables that the basecoat docs stylesheet used. From my quick manual test, it looked like the only missing rules were the theme declaration blocks (Claude, Cosmic, Tangerine, Supabase), so I've included them intailwind-input.cssas well. Note the miso-ui themes Cosmic and Tangerine aren't in the latest basecoat docs themes, I don't know where they originally come from. Regardless, I've copied them over.