---
title: "Bootstrap and bootstrap_package"
manual: "StyleX Connector"
version: "1.1"
permalink: "https://docs.typo3.org/permalink/skom/stylex-connector:bootstrap-integration@1.1"
source: "Integrations/Bootstrap.rst"
rendered: "2026-11-01T18:26:19+00:00"
---

# Bootstrap and bootstrap_package {#bootstrap-integration}

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](https://docs.typo3.org/permalink/skom/stylex-connector:installation@1.1).

| Site | Bootstrap CSS source | StyleX work |
| --- | --- | --- |
| New site using plain Bootstrap | Import `bootstrap/dist/css/bootstrap.min.css` in the Vite entrypoint. | Style the site's own templates and Content Blocks. |
| Existing `bootstrap_package` site with selected overrides | Keep `bootstrap_package` CSS and templates. | Override only selected templates or add new components. |
| Site replacing many `bootstrap_package` 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.entry.js`. For `bootstrap_package`, 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](https://docs.typo3.org/permalink/skom/stylex-connector:connect-typo3@1.1) remains the entrypoint for StyleX in either case.

## Bootstrap and cascade layers {#bootstrap-and-cascade-layers}

Put the intended layer order at the beginning of the consuming CSS build:

```css
@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_package` output
are unlayered, so use `useCSSLayers: false` 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
`overrideBootstrapPriority` compatibility setting uses `forceOnTop` for the known asset names
`bootstrap`, `bootstrap_package_bootstrap`, and `bootstrap_cdn`. See
[CSS delivery settings](https://docs.typo3.org/permalink/skom/stylex-connector:css-delivery-settings@1.1) for all related settings.
