Skip to content

feat(docs): add prettier-plugin-bootstrap for automatic class sorting#42383

Open
pierluigilenoci wants to merge 1 commit into
twbs:mainfrom
pierluigilenoci:feat/prettier-plugin-bootstrap
Open

feat(docs): add prettier-plugin-bootstrap for automatic class sorting#42383
pierluigilenoci wants to merge 1 commit into
twbs:mainfrom
pierluigilenoci:feat/prettier-plugin-bootstrap

Conversation

@pierluigilenoci

@pierluigilenoci pierluigilenoci commented May 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Add prettier-plugin-bootstrap to the docs site Prettier configuration for automatic Bootstrap CSS class sorting. This ensures consistent class ordering across all .astro files in site/.

Changes

  • package.json / package-lock.json: Add prettier-plugin-bootstrap@^0.3.0 as a dev dependency
  • site/.prettierrc.json: Register prettier-plugin-bootstrap alongside prettier-plugin-astro
  • 25 .astro files: Apply automatic class reordering produced by the new plugin (components, layouts, pages)

Notes

  • The plugin sorts Bootstrap utility classes into a canonical order (layout → spacing → typography → visual)
  • Only the site/ directory is affected; core Bootstrap source is untouched
  • All modified files pass prettier --check with the updated config

Status: ready for review

@pierluigilenoci

Copy link
Copy Markdown
Contributor Author

cc @julien-deramond @mdo @coliff — this adds automatic Bootstrap class sorting to the docs site via a Prettier plugin (similar to prettier-plugin-tailwindcss). Happy to adjust anything if needed.

@pierluigilenoci pierluigilenoci force-pushed the feat/prettier-plugin-bootstrap branch 4 times, most recently from 7d7841b to 4cb6504 Compare May 3, 2026 20:55
Comment thread site/.prettierrc.json Outdated
@pierluigilenoci pierluigilenoci force-pushed the feat/prettier-plugin-bootstrap branch 2 times, most recently from fb31ab8 to 1c07845 Compare May 21, 2026 19:35
@pierluigilenoci pierluigilenoci requested a review from coliff May 21, 2026 19:42
@pierluigilenoci

Copy link
Copy Markdown
Contributor Author

Update: addressed @coliff's review — consolidated the plugins array on a single line in site/.prettierrc.json (the previous version had a duplicate plugins key, which is now removed). Also refreshed the PR description: the dependency on #42389 is no longer relevant since #42390 (which enabled prettier-plugin-astro upstream) was merged. All CI green ✅, branch is up-to-date with main. Ready for another look whenever convenient — thanks!

@pierluigilenoci pierluigilenoci force-pushed the feat/prettier-plugin-bootstrap branch 2 times, most recently from fd6303c to 51e3b49 Compare June 9, 2026 12:52
Adds `prettier-plugin-bootstrap` (v0.3.0) to automatically sort Bootstrap
CSS classes following the framework's architecture order.

- Adds `prettier-plugin-bootstrap@^0.3.0` as a dev dependency
- Configures `.prettierrc.json` with the plugin (after prettier-plugin-astro)
- Reformats 28 `.astro` files with sorted class attributes (no functional changes)

Plugin features:
- Sorts classes: layout → components → helpers → utilities
- Responsive variants sort after their base class
- Supports HTML, JSX/TSX, Vue, Angular, Svelte, and Astro
- Public sorting API via `prettier-plugin-bootstrap/sorter`
- 121 tests, 100% coverage, zero runtime dependencies

Signed-off-by: Pierluigi Lenoci <pierluigilenoci@gmail.com>
@pierluigilenoci pierluigilenoci force-pushed the feat/prettier-plugin-bootstrap branch from 51e3b49 to dc668d1 Compare June 10, 2026 14:23
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.

3 participants