PHPackages                             jbsnewmedia/bootstrap-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. jbsnewmedia/bootstrap-bundle

ActiveSymfony-bundle[CLI &amp; Console](/categories/cli)

jbsnewmedia/bootstrap-bundle
============================

Lightweight tools to scaffold and compile Bootstrap SCSS using scssphp. Provides console commands (bootstrap:init, bootstrap:compile) with sensible defaults and vendor-aware import paths.

1.0.5(3mo ago)125MITPHPPHP &gt;=8.2CI passing

Since Nov 24Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/jbsnewmedia/bootstrap-bundle)[ Packagist](https://packagist.org/packages/jbsnewmedia/bootstrap-bundle)[ RSS](/packages/jbsnewmedia-bootstrap-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (6)Versions (7)Used By (0)

Bootstrap Bundle
================

[](#bootstrap-bundle)

[![Packagist Version](https://camo.githubusercontent.com/70dddb79e7704684dee98c97c7a575dcdd90dae0ff5d2b9a4442b8606764639a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a62736e65776d656469612f626f6f7473747261702d62756e646c65)](https://packagist.org/packages/jbsnewmedia/bootstrap-bundle)[![Packagist Downloads](https://camo.githubusercontent.com/74a90545b39d28e6a3a1fe3de5a43a7ebcf4795f52ae5bd81af5fd456b6fa94a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a62736e65776d656469612f626f6f7473747261702d62756e646c65)](https://packagist.org/packages/jbsnewmedia/bootstrap-bundle)[![PHP Version Require](https://camo.githubusercontent.com/705696048229eb345a749d33f0ec9c32810e985f8d501f62a8df70747c71096b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6a62736e65776d656469612f626f6f7473747261702d62756e646c65)](https://packagist.org/packages/jbsnewmedia/bootstrap-bundle)[![Symfony Version](https://camo.githubusercontent.com/ce7f7484cab9ad5373e96792620d4513e1ea50164d4c1c283a1b3a2bed55261c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73796d666f6e792d253545372e342d3637336162373f6c6f676f3d73796d666f6e79)](https://symfony.com)[![License](https://camo.githubusercontent.com/edd10a8e06f548e835c0e3f2daa45d1b620168423cfe0d4e6fc96918335e2cdc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6a62736e65776d656469612f626f6f7473747261702d62756e646c65)](https://packagist.org/packages/jbsnewmedia/bootstrap-bundle)[![Tests](https://github.com/jbsnewmedia/bootstrap-bundle/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/jbsnewmedia/bootstrap-bundle/actions/workflows/tests.yml)[![PHP CS Fixer](https://camo.githubusercontent.com/056e5fa4bcf9273c04257a42b6365d1d1f431d5ea1eae0c759754f8549af2b49/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2d63732d2d66697865722d636865636b65642d627269676874677265656e)](https://github.com/jbsnewmedia/bootstrap-bundle/actions/workflows/tests.yml)[![PHPStan](https://camo.githubusercontent.com/6e8e5bc365d34c98ba2b8b6caf2bdfaa5bccb21bc13931acc6e8717581207355/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068707374616e2d616e616c797365642d627269676874677265656e)](https://github.com/jbsnewmedia/bootstrap-bundle/actions/workflows/tests.yml)[![Rector](https://camo.githubusercontent.com/e74d169a31106980ccbf6ce8ae0436dc5a603c72c76c746a156282c07dd504b3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f726563746f722d636865636b65642d627269676874677265656e)](https://github.com/jbsnewmedia/bootstrap-bundle/actions/workflows/tests.yml)[![codecov](https://camo.githubusercontent.com/5c83576e65717e07e7537460a6de30de0f4c0678a12554e035f8656b422b4f4b/68747470733a2f2f636f6465636f762e696f2f67682f6a62736e65776d656469612f626f6f7473747261702d62756e646c652f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/jbsnewmedia/bootstrap-bundle)

A lightweight Symfony bundle that helps you scaffold and compile Bootstrap SCSS with [scssphp](https://github.com/scssphp/scssphp). It ships three console commands:

- `bootstrap:init` — scaffolds SCSS entry files under `assets/scss/`.
- `bootstrap:compile` — compiles SCSS to CSS (with sensible defaults and vendor‑aware import paths).
- `bootstrap:purge` — purges compiled Bootstrap CSS by scanning your templates.

---

🚀 Features
----------

[](#-features)

- Ready‑to‑use SCSS entries (light and dark)
- SCSS → CSS via scssphp (pure PHP, no Node required)
- Writes readable and minified CSS in one run
- Optional source maps for each output (`--source-map`)
- Include paths for `vendor/twbs/bootstrap/scss` out of the box
- Purge Bootstrap CSS based on your templates (`bootstrap:purge`)
- Clean defaults and sensible paths

---

⚙️ Requirements
---------------

[](#️-requirements)

- PHP 8.2 or higher
- Symfony 6.4 or 7.x (framework‑bundle, console)
- Composer
- Dependencies:
    - `twbs/bootstrap` (&gt;= 5.3)
    - `scssphp/scssphp` (^2.0)
    - `jbsnewmedia/css-purger` (^1.0)

Note: This is a regular Symfony bundle and expects a Symfony kernel (it is auto‑registered).

---

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require jbsnewmedia/bootstrap-bundle
```

If not already present, Composer will install the required packages (`twbs/bootstrap`, `scssphp/scssphp`).

---

📋 Usage
-------

[](#-usage)

### 1) Scaffold SCSS entries

[](#1-scaffold-scss-entries)

Create the default SCSS entry files under `assets/scss/`:

```
php bin/console bootstrap:init
# preview without writing files
php bin/console bootstrap:init --dry-run
# overwrite existing files
php bin/console bootstrap:init --force
```

Files created:

- `assets/scss/bootstrap5-custom.scss`
- `assets/scss/bootstrap5-custom-dark.scss`

Both entries import Bootstrap after your variable overrides in the correct order.

### 2) Compile SCSS → CSS

[](#2-compile-scss--css)

Compile with sensible defaults:

```
php bin/console bootstrap:compile
```

Defaults:

- Input: `assets/scss/bootstrap5-custom.scss`
- Outputs:
    - readable CSS → `assets/css/bootstrap.css`
    - minified CSS → `assets/css/bootstrap.min.css`

Readable output path can be adjusted via `--output-normal`.

Generate a source map:

```
php bin/console bootstrap:compile --source-map
```

Custom input/output paths:

```
php bin/console bootstrap:compile path/to/entry.scss public/css/app.css
```

### 3) Purge unused Bootstrap CSS (optional)

[](#3-purge-unused-bootstrap-css-optional)

After compiling, you can purge unused selectors by scanning your templates:

```
php bin/console bootstrap:purge \
  --input=assets/css/bootstrap.css \
  --output=assets/css/bootstrap-purged.css \
  --templates-dir=templates \
  --include-dir=src \
  --include-file=assets/app.js \
  --selector=collapse --selector=show
```

---

🧩 Command reference
-------------------

[](#-command-reference)

### bootstrap:init

[](#bootstrapinit)

Scaffolds Bootstrap SCSS entry files.

- Options:
    - `--dry-run` — show what would be written without creating files
    - `-f, --force` — overwrite existing files
- Alias: `boostrap:init` (common typo)

Creates the following files in `assets/scss/`:

- `bootstrap5-custom.scss` (light)
- `bootstrap5-custom-dark.scss` (dark)

Recommended order inside the files: functions → your variable overrides → Bootstrap import.

### bootstrap:compile

[](#bootstrapcompile)

Compiles SCSS to CSS using scssphp.

- Arguments:
    - `input` (optional) — SCSS entry file; default `assets/scss/bootstrap5-custom.scss`
    - `output` (optional) — minified CSS output file; default `assets/css/bootstrap.min.css`
- Options:
    - `--output-normal`, `-O` — readable (non‑minified) CSS output path; default `assets/css/bootstrap.css`
    - `--source-map` — write a `.map` file next to each CSS output (readable and minified)

Preconfigured include paths (in this order):

1. `vendor/twbs/bootstrap/scss`
2. `vendor`
3. `assets/scss`
4. `assets`

This allows imports like:

```
@import "functions";
@import "variables";
@import "bootstrap";
```

### bootstrap:purge

[](#bootstrappurge)

Purges Bootstrap CSS by scanning your templates and keeping only the selectors that are found.

- Options:
    - `--input`, `-i` — path to input CSS file; default `assets/css/bootstrap.css`
    - `--output`, `-o` — path to write the purged CSS; default `assets/css/bootstrap-purged.css`
    - `--templates-dir` — template directories to scan (multiple allowed)
    - `--include-dir`, `-D` — additional directories to scan (multiple allowed)
    - `--include-file`, `-F` — additional files to scan (multiple allowed)
    - `--selector`, `-S` — selectors to always keep (multiple allowed)
    - `--readable`, `-r` — generate human‑readable (pretty) CSS output
    - `--dry-run` — show stats without writing the output file

### Source map behavior

[](#source-map-behavior)

When using `--source-map`, a map is written for each output:

- Readable CSS: `assets/css/bootstrap.css` + map `assets/css/bootstrap.css.map`
- Minified CSS: `assets/css/bootstrap.min.css` + map `assets/css/bootstrap.min.css.map`

Example console output:

```
Compiled (readable) assets/scss/bootstrap5-custom.scss -> assets/css/bootstrap.css
Source map written: assets/css/bootstrap.css.map
Compiled (minified) assets/scss/bootstrap5-custom.scss -> assets/css/bootstrap.min.css
Source map written: assets/css/bootstrap.min.css.map

```

If no map is written even though `--source-map` is set, please check that your SCSS source actually produces output and that the defaults were not overridden.

---

✍️ Example SCSS
---------------

[](#️-example-scss)

Light (created by `bootstrap:init`):

```
// Project-wide Bootstrap configuration
// -------------------------------------------------
// Order matters: load functions first, then override variables,
// then import Bootstrap.

// 1) Bootstrap functions (used in variable calculations)
@import "functions";

// 2) Your variable overrides (omit !default so they actually apply)
$primary: #ff0000;

// 3) Optional: load Bootstrap base variables
@import "variables";

// 4) Import full Bootstrap
@import "bootstrap";
```

Dark (created by `bootstrap:init`):

```
// Dark mode build for Bootstrap
// -------------------------------------------------
// 1) Load Bootstrap functions
@import "functions";

// 2) Set dark-specific variables (adjust examples as needed)
$body-bg: #121212;
$body-color: #e6e6e6;
$primary: #0d6efd;

// Optional: load additional maps/variables from Bootstrap
@import "variables";

// 3) Import full Bootstrap
@import "bootstrap";
```

---

🧭 Troubleshooting
-----------------

[](#-troubleshooting)

- Input file not found
    - Run `php bin/console bootstrap:init` to create default entries, or pass your own path to `bootstrap:compile`.
- Bootstrap imports not resolved
    - Ensure `twbs/bootstrap` is installed: `composer require twbs/bootstrap`.
- Source map comment is present, but no file is written
    - With the current implementation the map is written after compilation. Check that `--source-map` is set and your SCSS produces content.
- scssphp versions
    - This bundle targets `scssphp/scssphp` ^2.0. If you use another major version, adjust accordingly.

---

ℹ️ Git information
------------------

[](#ℹ️-git-information)

- Latest tag: `1.0.2`
- Last commit: `ffb3318` — 2026-02-09

---

📜 License
---------

[](#-license)

Licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

Developed by Juergen Schwind and contributors.

---

🤝 Contribution
--------------

[](#-contribution)

Contributions are welcome! Please fork the repository and open a pull request. For larger changes, consider opening an issue first to discuss your idea.

---

📫 Contact
---------

[](#-contact)

For questions or issues, please open an issue or a pull request in the repository.

— Simple Bootstrap SCSS scaffolding and compilation, Composer‑native.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance82

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~15 days

Total

6

Last Release

93d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/44b85e5ce069ccae08123600bb24204ea8fe99c8cb5cbfae108ff29c179e503d?d=identicon)[jschwind](/maintainers/jschwind)

---

Top Contributors

[![jschwind](https://avatars.githubusercontent.com/u/985564?v=4)](https://github.com/jschwind "jschwind (33 commits)")

---

Tags

bootstrapbootstrap5compile-scsspurge-csspurgecssscsssymfonysymfony-bundle

### Embed Badge

![Health badge](/badges/jbsnewmedia-bootstrap-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/jbsnewmedia-bootstrap-bundle/health.svg)](https://phpackages.com/packages/jbsnewmedia-bootstrap-bundle)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[shopware/storefront

Storefront for Shopware

684.2M148](/packages/shopware-storefront)[matthiasnoback/symfony-console-form

Use Symfony forms for Console command input

368264.8k8](/packages/matthiasnoback-symfony-console-form)[shel/neos-terminal

Neos CMS Ui terminal for running Eel expressions and other commands

1441.3k](/packages/shel-neos-terminal)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
