Repository navigation
feat: custom Tailwind configs + CSS Grid Level 1 (Phase A) - #18
Merged
Merged
Conversation
- Replaces "no build step" with "no Tailwind CLI required" across README, site docs, and llms.txt (the old phrasing was ambiguous — every Go consumer has a build step). - Adds "Custom config" section to the Tailwind guide covering the Go struct, Tailwind v4 @theme CSS, and JSON payload variants, plus precedence rules and trust/immutability notes. - Adds a new CSS Grid guide covering track sizing, placement, and Phase A limitations. - Adds Grid class tables to the Tailwind reference and mentions grid and custom configs in the README feature list.
Two new capabilities, threaded through Options, HTTP handler, server, and CLI: TailwindConfig — extends the built-in class table with: - Custom color palettes (Colors[name][shade]) - Custom spacing keys (Spacing[key]) - Font family utilities (Fonts[key]) - Arbitrary class overrides (Extend[cls][prop]) Three input surfaces: - Go struct: Options.TailwindConfig - Tailwind v4 @theme CSS: --tailwind-config theme.css or POST body - JSON: matching struct schema, --tailwind-config theme.json or POST body Per-config resolver cache keyed by SHA-256 of sorted maps so distinct configs never share entries; nil-config path is unchanged. Server cache key incorporates cfg.Key() so different-config renders don't collide. Renderer.Handler now enforces a 10 MB request body cap. CSS Grid — new layout/grid.go implements CSS Grid Level 1 (Phase A): - display: grid dispatch alongside flex - Track sizing: fixed length, percent, fr distribution, auto - Track template parsing: repeat(N, ...), minmax(a, b) (max only), auto / min-content / max-content collapse to auto - Placement: explicit line indices (positive and negative — col-span-full works), span shorthand, single-axis definite placement (spec §8.5 minor-axis-definite bucket), and auto-placement with row/column flow - Auto-placement bounded at 10,000 implicit tracks to prevent runaway growth from pathological input - Gap, row-gap, column-gap - Tailwind grid utilities: grid, inline-grid, grid-cols-{1..12}, grid-rows-{1..6}, col-span-{N}, col-span-full, col-start/end, row-span-{N}, row-span-full, row-start/end, grid-flow-*, auto-cols/rows-* Deferrals (documented in the grid guide): - minmax lower bound not enforced - min/max/fit-content degrade to auto - No grid-template-areas, named lines, or subgrid - No auto-fill / auto-fit repeat expansion - justify-self / align-self within cells degrades to stretch
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.
Summary
Two new capabilities threaded through library, CLI, and HTTP server.
Custom Tailwind configs — extend the built-in palette, spacing scale, font stacks, or inject arbitrary classes via three interchangeable surfaces:
Options.TailwindConfig)--tailwind-config theme.css)tailwindConfig/ `tailwindConfigCSS` HTTP payload fields)Per-config resolver cache keyed by content hash so different configs never share entries; nil-config hot path is unchanged.
Renderer.Handlernow enforces a 10 MB request-body cap.CSS Grid — new
layout/grid.goimplements CSS Grid Level 1 (Phase A):display: griddispatch alongside flexrepeat(N, ...),minmax(a, b)(max value)col-span-fullworks), span, single-axis definite placement per spec §8.5 minor-axis-definite bucket, and auto-placement with row/column flow, capped at 10k implicit tracksgrid,inline-grid,grid-cols-{1..12},grid-rows-{1..6},col-span-{N},col-span-full,col-start/end,row-*,grid-flow-*,auto-cols/rows-*Also drops the "no build step" wording ("no Tailwind CLI required" everywhere), adds a new CSS Grid guide, and updates the CLI
--helpto reflect grid support + the new--tailwind-configflag.Phase A limitations (deferred to follow-ups)
minmax()lower bound not enforcedmin-content/max-content/fit-content()degrade to autogrid-template-areas, named lines, or subgridrepeat(auto-fill/auto-fit, ...)justify-self/align-selfdegrades to stretchTest plan
go test ./...— all packages greencol-span-full, single-axis placement, negative line end,end < startswap, unbounded span cap, auto-flow, percent tracks