Skip to content

Pull along Tailwind configuration, generating CSS again#617

Merged
dschrempf merged 17 commits into
haskellfoundation:hakyllfrom
dschrempf:tailwind
Jul 12, 2026
Merged

Pull along Tailwind configuration, generating CSS again#617
dschrempf merged 17 commits into
haskellfoundation:hakyllfrom
dschrempf:tailwind

Conversation

@dschrempf

@dschrempf dschrempf commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Late-stage draft (there are a few things to do, see below).

This supersedes #281.

This PR (#281) reintroduces a working, checked-in Tailwind/PostCSS build for assets/css/main.css after it had bitrotted, and wires it into both local dev and CI:

  • Restores Tailwind + PostCSS compilation of main.css, matching the old (Tailwind v2-era) visual output as closely as possible, then migrates the config to Tailwind v4's CSS-native @theme/@source setup (no more tailwind.config.js).
  • Adds a dev.css snapshot committed to the repo so stack exec site build/watch still works without Node — site.hs concatenates it onto tailwind.css at compile time.
  • Adds a Nix flake dev shell (replacing the old, unused dep/nixpkgs/dep/node node2nix setup) providing node/npm for anyone who does need to rebuild the real CSS.
  • Adds a CI step that builds the production CSS with npm as part of the site build.
  • Documents the whole Node/Tailwind/PostCSS workflow in the README.
  • Minor follow-up: sets headings back to weight 400 and drops the now-unused font-w-800 utility.

The website content remains unchanged.

Review concerns of #281 already addressed at this stage of the PR:

  • README explains when Node is needed
  • Adapt "nodejs nonsense" comment
  • hackyll typos + wrong paths + ambiguous "this file" wording (tailwind.css header)

Review concerns not yet addressed:

  • cat-based concat breaks Windows (site.hs:41)
  • Isolate Node/node_modules into its own dir
  • CI drift-check for dev.css

Review concerns that are not valid anymore due to upgrade to Tailwind 4

  • tailwind.config.js "3"→"3px" nit

Note: Some of this work was done by an LLM; I have reviewed all changes and tested the local site builds, but I am declaring this here, since there are ongoing discussions about the use of LLMs in the Haskell community.

hazelweakly and others added 12 commits July 7, 2026 17:14
Config moves from tailwind.config.js (deleted) into
assets/css/tailwind.css (@theme/@source/@plugin); postcss.config.js uses
@tailwindcss/postcss and drops postcss-import. Regenerate the dev.css snapshot.

Address PR haskellfoundation#281 review: the README now documents when Node is needed vs. the
Node-free dev.css preview, gives Stack and Cabal equal billing (and fixes the
broken 'cabal run -- site build' invocation), and updates the stale CI step
list. Drop the disparaging site.hs comment and fix the hakyll typos, wrong
paths, and ambiguous wording in the tailwind.css header.
The heading rule asked for 700, but the Google Fonts link only loads Playfair
Display 400/600/800, so headings snapped to 800 (extra-bold). Regular reads
better across the site. With headings now 400, the font-w-800 utility (only on
the homepage hero) was dead, so remove its @theme token and the class.
@dschrempf

Copy link
Copy Markdown
Collaborator Author

Pulling @LaurentRDC @jaspervdj in.

Comment thread site.hs
Comment thread site.hs Outdated
Comment thread README.md
Comment thread site.hs Outdated
config :: Configuration
config = defaultConfiguration
{ ignoreFile = \file ->
"node_modules" `isPrefixOf` file ||

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this here in e769aa5, rather than having the ignore on individual matches.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I will apply the commit. I guess this will also have consequences on "isolating node_modules", which is still an open task.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I saw that you already applied it yourself!

dev.css is a checked-in snapshot of `npm run build` (concatenated onto
tailwind.css by site.hs for Node-less previews).

Add `npm run build:dev-snapshot` as the single canonical regeneration
command (writes dev.css in place) and a CI step that runs it and fails via `git
diff` if the committed copy is stale.
@dschrempf

Copy link
Copy Markdown
Collaborator Author

Last TODO: Isolate node tooling.

There is a potential followup: We are using "custom font size utilities with standard Tailwind prefixes" (e.g., text-Nxl-Mxl). This is bad practice, we should just use the standard expressions such as text-2xl md:text-4xl. However, this requires changes in many posts. We could fix this technical debt in a separate PR (if we want to fix it at all).

Move `package.json`, `package-lock.json`, `postcss.config.js` and `node_modules`
out of the repo root into `tools/tailwind/`, so the Node and Hakyll build
systems no longer share a directory (PR haskellfoundation#281 review).

The build still runs from the repo root — Tailwind v4's `@source` only scans
at/below the CWD — so the npm scripts `cd` back up. Since `node_modules` is no
longer an ancestor of `assets/css/tailwind.css`, that file's `@import/@plugin` use
relative paths into `tools/tailwind/node_modules`. Hakyll's ignoreFile now skips
`tools/` instead of `node_modules`.

Output is byte-identical to the pre-move build.
@dschrempf

Copy link
Copy Markdown
Collaborator Author

OK, moved Tailwind/Node stuff to tools/tailwind. Site builds fine locally, and also looks identical to the production one.

If there are no more review requests or objections, I would merge maybe tomorrow or the day after tomorrow. @LaurentRDC @jaspervdj

@LaurentRDC

Copy link
Copy Markdown
Contributor

Fine by me!

@dschrempf
dschrempf merged commit 681e88d into haskellfoundation:hakyll Jul 12, 2026
1 check passed
@dschrempf dschrempf mentioned this pull request Jul 12, 2026
@dschrempf
dschrempf deleted the tailwind branch July 13, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants