JM: Introduce button_classes helper (move buttons off @apply) - #2297
Draft
maebeale wants to merge 1 commit into
Draft
JM: Introduce button_classes helper (move buttons off @apply)#2297maebeale wants to merge 1 commit into
maebeale wants to merge 1 commit into
Conversation
Introduce ButtonHelper#button_classes as the single source of truth for button styling, emitting Tailwind utilities from a helper (scanned via @source) instead of the @apply-based .btn/.btn-* component classes — per Evil Martians best practice #4. Convert the event registration-flow buttons (registration section, event show, event card, scholarship callout) as the reference pattern. buttons.css is intentionally left in place: the ~200 remaining call sites still depend on it, so the helper and the @apply classes coexist during an incremental rollout (no visual change, nothing breaks). Size handling is explicit (size: :md default, :sm, or nil) because conflicting utilities in one class list resolve by Tailwind's generation order, not markup order — the old component/utility layer split is gone once styles are inlined. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
@jmilljr24 curious if you think this work it to move off tailwind apply |
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.
🤖 suggested review level: 3 Read 📖 new helper + reference conversion of the event-flow buttons; rest of the app unchanged
Why
@applycomponent classes in CSS.@applyhides where styles change and bloats the bundle.What
ButtonHelper#button_classes(variant, size:, extra:)— single source of truth for base + all variants + sizes. Tailwind already scansapp/helpers/**/*.rb, so the utility strings generate normally.Deliberately incremental
buttons.css(.btn/.btn-*@apply) stays — the ~200 remaining call sites still use it, so helper +@applycoexist with zero visual change. Convert-on-next-touch, per the same Evil Martians guidance against big-bang@applyrewrites.Gotcha this design handles
.btn's padding lives in thecomponentslayer, so a call site'spx-10/text-2xl(in theutilitieslayer) overrides it. Once styles are inlined they're all utilities in one class list, where conflicts resolve by Tailwind's generation order, not markup order. Sosize:is explicit::md(default),:sm, ornilwhen the call site supplies its own padding/text-size viaextra:.Open question