Bootstrap and bootstrap_package
Decide which system supplies the site's Bootstrap CSS before adding StyleX. This changes CSS imports and template ownership, not the base connector or manifest setup in Installation.
| Site | Bootstrap CSS source | StyleX work |
|---|---|---|
| New site using plain Bootstrap | Import bootstrap/ in the Vite entrypoint. | Style the site's own templates and Content Blocks. |
Existing bootstrap_ site with selected overrides | Keep bootstrap_ CSS and templates. | Override only selected templates or add new components. |
Site replacing many bootstrap_ templates | Keep its CSS while the replacement is incomplete. | Move components to StyleX gradually and remove unused CSS deliberately. |
For plain Bootstrap, install the npm package and import its CSS once in
Main.. For bootstrap_, keep its sitepackage and Site
Set dependencies, and import only the JavaScript or additional styles that
the project needs. Check whether the existing theme already loads Bootstrap
JavaScript before importing it through Vite too. The asset collector call in
Connect the build to TYPO3 remains the entrypoint for StyleX in either case.
Bootstrap and cascade layers
Put the intended layer order at the beginning of the consuming CSS build:
@layer bootstrap, stylex, overrides;
This declaration does not move Bootstrap CSS into a layer. For normal CSS
rules, unlayered CSS wins over layered CSS regardless of selector
specificity. A typical Bootstrap import and bootstrap_ output
are unlayered, so use use in the StyleX Vite plugin for
those setups. The base Vite example does this.
Enable StyleX layers only when the project also compiles Bootstrap into @layer bootstrap. Check the emitted
CSS and computed styles before relying on that order. If TYPO3 includes CSS
through the connector's optional TypoScript path, the
override compatibility setting uses force for the known asset names
bootstrap, bootstrap_, and bootstrap_. See
CSS delivery settings for all related settings.