A Prettier plugin that automatically sorts Bootstrap CSS classes following the framework's recommended order (layout → components → utilities). Current stable version is 0.3.0, released May 2026, with regular releases. Key differentiators: zero configuration, works with multiple template engines (HTML, JSX/TSX, Vue, Angular, Svelte, Astro), supports custom attributes and functions like clsx, and preserves unknown classes. Requires Prettier ^3.0.0 and Node >=20. Offers options for attribute matching (regex), whitespace preservation, duplicate handling, and version targeting.
npm install prettier-plugin-bootstrapNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows installation, configuration with options, and the sorting result on an HTML file.
Use dynamic import(): const plugin = await import('prettier-plugin-bootstrap'); or set type: module.Set bootstrapPreserveWhitespace: true if original spacing is important.
Set bootstrapVersion: 5 for now.
Upgrade to Prettier 3.x: npm install -D prettier@^3.0.0
Use full pattern like /^data-class/ or an exact string.
Set bootstrapPreserveDuplicates: false to remove duplicates.
Run: npm install -D prettier-plugin-bootstrap
Use dynamic import: const plugin = await import('prettier-plugin-bootstrap'); or set "type": "module" in package.json.Upgrade to Prettier 3.x: npm install -D prettier@^3