Skip to content

docs: optimizing CSS size guide with measured flavors; scaffold size hints - #309

Merged
allxsmith merged 2 commits into
mainfrom
docs/193-bundle-size
Jul 14, 2026
Merged

allxsmith merged 2 commits into
mainfrom
docs/193-bundle-size

Conversation

@allxsmith

@allxsmith allxsmith commented Jul 14, 2026 •

Copy link
Copy Markdown
Owner

Pull Request

Description

The docs/guidance half of #193 (the opt-in purge tooling in the scaffold needs a design decision and stays open on the issue).

  • bulma-ui (@allxsmith/bestax-bulma)
  • create-bestax (create-bestax) — flavor-picker descriptions gain gzip size hints
  • docs (@allxsmith/bestax-docs) — new guide + variations cross-link
  • Other (please specify):

New guide: docs/guides/getting-started/optimizing-css — the three levers, cheapest first:

  1. Lighter flavors — a size table measured from the current minified dist (complete ~800 KB / ~82 KB gzip → no-helpers ~595 KB / ~67 KB), with the critical warning that no-helpers removes the classes the helper props compile to. (The issue's ~873 KB figure included app CSS; the library file itself measures ~800 KB.)
  2. Opt-in PurgeCSS recipe for Vite — production-only PostCSS config with a Bulma-aware safelist (is-*/has-* state classes, theme-dark/light scheme flips, bestax-* prefix) and explicit verify-your-dynamic-states guidance, since purging is heuristic.
  3. Modular Sass — points at the existing Modular guide's Option C rather than duplicating it.

Scaffold-time guidance (issue ask #2): the create-bestax flavor picker descriptions now carry the gzip sizes (Full Bulma CSS … (~82 KB gzip), no-helpers … helper props need them (~67 KB gzip), etc.), so the tradeoff is visible exactly when the user picks complete. String-only change; all 187 create-bestax tests pass.

Cross-links: variations.md gains a size line pointing at the new page; the guide links Dark Mode & Contrast (pin the scheme before reaching for no-dark-mode).

Related Issue(s)

Refs #193 (docs half — the scaffold purge tooling remains open there)

Type of Change

  • Documentation
  • Other: scaffold display strings (create-bestax)

Checklist

  • My code follows the project style guidelines
  • I have performed a self-review of my code
  • I have added/updated documentation as needed
  • All new and existing tests passed (create-bestax 187/187; typecheck; prettier + format:check; full docs build green including the Option C anchor)
  • If this PR changes commands, conventions, or package structure, the affected CLAUDE.md files are updated (none affected)

🤖 Generated with Claude Code

https://claude.ai/code/session_01Pohc8xLkdx4gwXkW3xd7up


Generated by Claude Code

Summary by CodeRabbit

  • Documentation
    • Added an “Optimizing CSS Size” guide covering lighter Bulma flavor selection, production PurgeCSS setup (with example configuration and safelisting guidance), and optional modular Sass loading.
    • Updated “CSS Variations” documentation to clarify that variations differ by file size and to reference the new optimization guidance.
  • Enhancements
    • Updated the available Bulma flavor descriptions to include approximate gzipped bundle sizes (and improved formatting for readability).

…hints

The docs half of #193. New getting-started page with the three levers,
cheapest first: (1) lighter flavors — a measured size table from the
current minified dist (complete ~800KB/~82KB gzip down to no-helpers
~595KB/~67KB), with the no-helpers warning that helper props compile to
the removed classes; (2) an opt-in PurgeCSS recipe for Vite with the
Bulma-aware safelist (is-/has-/theme-*/bestax-*) and verify-your-states
guidance; (3) the modular Sass path via the existing Modular guide.
variations.md links to it; the create-bestax flavor picker descriptions
now carry the gzip sizes so the tradeoff is visible at scaffold time.

The opt-in purge tooling in the scaffold itself (issue's remaining half)
still needs a design decision and stays open on #193.

Refs #193

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pohc8xLkdx4gwXkW3xd7up
@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ba466625-0f5c-41e9-89a5-fe30f634bb80

📥 Commits

Reviewing files that changed from the base of the PR and between c4f4e5c and 53e825b.

📒 Files selected for processing (1)
  • docs/docs/guides/getting-started/optimizing-css.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/docs/guides/getting-started/optimizing-css.md

Walkthrough

Updated Bulma flavor metadata with approximate gzip sizes and added documentation covering flavor selection, PurgeCSS, modular Sass, CSS variation sizes, and related optimization guidance.

Changes

CSS size guidance

Layer / File(s) Summary
Flavor size metadata
create-bestax/src/constants.ts
Bulma flavor descriptions now include approximate gzip bundle sizes.
CSS optimization documentation
docs/docs/guides/getting-started/optimizing-css.md, docs/docs/guides/getting-started/variations.md
Adds guidance for choosing lighter flavors, configuring PurgeCSS, using modular Sass, comparing variation sizes, and navigating related documentation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is specific, concise, and matches the main doc and scaffold size-hint updates.
Description check ✅ Passed The description covers the required summary, affected packages, issue reference, type of change, and checklist entries.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/193-bundle-size

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Preview Deployment

Preview URL: https://34659857.bestax.pages.dev

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/docs/guides/getting-started/optimizing-css.md`:
- Around line 60-69: Add PurgeCSS safelist patterns in the shown `purgecss`
configuration for the spacing utility classes emitted by `useSpacingClasses`,
covering `m-*`, `p-*`, and axis variants such as `mx-*` and `py-*`, while
preserving the existing `is-*`, `has-*`, theme, and `bestax-*` patterns.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9216d286-0a73-4676-b7a1-58f949ecc2d3

📥 Commits

Reviewing files that changed from the base of the PR and between 74e3d4e and c4f4e5c.

📒 Files selected for processing (3)
  • create-bestax/src/constants.ts
  • docs/docs/guides/getting-started/optimizing-css.md
  • docs/docs/guides/getting-started/variations.md

Comment thread docs/docs/guides/getting-started/optimizing-css.md
Comment thread docs/docs/guides/getting-started/optimizing-css.md Outdated

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Deep review — 1 finding

# Severity Area Finding Location
1 🟠 Major Correctness PurgeCSS safelist targets the .theme-* class form, but bestax toggles dark mode via the data-theme attribute — the recipe can purge the very scheme flip it promises to protect docs/docs/guides/getting-started/optimizing-css.md:66-68

Overall: This is a well-scoped docs + scaffold-strings change; the flavor size table is internally consistent with the create-bestax descriptions, both doc anchors (#option-c--hand-rolled-modular-scss-advanced, #dark-mode--contrast) resolve, all five CSS import paths are real package exports, and sidebar_position: 6 is unused so no ordering clash. The one substantive risk is the PurgeCSS safelist in Lever 2: bestax's <Theme colorMode> writes data-theme="dark" on <html> (never a .theme-dark class), and the /theme-dark///theme-light/ patterns don't match the [data-theme=…] selector string — so a reader copying the recipe could ship a build where dark mode silently no-ops. Human should focus there; the guide's own "verify both schemes" caveat softens it, but the default recipe should be correct out of the box. I did not independently re-measure the dist byte sizes (dist isn't built in the checkout), but the figures are approximate and cross-consistent.

🏄 Solid little guide, dude — clean lines, good vibes, the size table and links all hold up. Just one gnarly rock under the surf: the purge safelist waves at .theme-dark while the app's actually riding data-theme, so tighten that up and you're good to paddle out.

Review findings on the Lever 2 safelist, all verified against the
helper implementation and Bulma's emitted selectors:

- Safelist the spacing classes (m-*/p-* and axis variants) —
  useSpacingClasses composes them at runtime, so content scanning
  never sees them (CodeRabbit).
- Safelist the [data-theme] attribute selector — Theme colorMode sets
  the attribute, and /theme-dark/ does not match '[data-theme=dark]',
  so PurgeCSS could prune the exact scheme flip the comment promised
  to protect (deep review).
- Scan the library bundle in content — the static class literals
  (button, card, …) live in dist, not app source, and 'Button' in JSX
  does not match '.button' case-sensitively.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pohc8xLkdx4gwXkW3xd7up
@github-actions

Copy link
Copy Markdown
Contributor

Preview Deployment

Preview URL: https://41fe934b.bestax.pages.dev

@allxsmith
allxsmith merged commit b0139d2 into main Jul 14, 2026
45 checks passed
@allxsmith
allxsmith deleted the docs/193-bundle-size branch July 14, 2026 23:59
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 5.6.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bestax-release-bot

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants