PHPackages                             heimrichhannot/contao-encore-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. heimrichhannot/contao-encore-bundle

ActiveContao-bundle

heimrichhannot/contao-encore-bundle
===================================

This bundle brings deep integration for symfony encore into contao. On the one hand, your can prepare your bundles to define own webpack entries, which added with just one command to your webpack entries. On the other hand, this bundle allows you to add encore entries only on the pages you need them for optimizing your website performance.

2.1.0(1y ago)1015.7k↓35.7%5[5 issues](https://github.com/heimrichhannot/contao-encore-bundle/issues)[1 PRs](https://github.com/heimrichhannot/contao-encore-bundle/pulls)LGPL-3.0-or-laterPHPPHP ^8.1CI failing

Since Sep 25Pushed 1mo ago4 watchersCompare

[ Source](https://github.com/heimrichhannot/contao-encore-bundle)[ Packagist](https://packagist.org/packages/heimrichhannot/contao-encore-bundle)[ Docs](https://github.com/heimrichhannot/contao-encore-bundle)[ RSS](/packages/heimrichhannot-contao-encore-bundle/feed)WikiDiscussions v2 Synced 1mo ago

READMEChangelog (10)Dependencies (27)Versions (82)Used By (0)

Contao Encore Bundle
====================

[](#contao-encore-bundle)

[![Latest Stable Version](https://camo.githubusercontent.com/9ca7255715e5b8b20205da3919a47d8505830b7fa82f8c778edc12ea4ad662c3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6865696d7269636868616e6e6f742f636f6e74616f2d656e636f72652d62756e646c652e737667)](https://packagist.org/packages/heimrichhannot/contao-encore-bundle)[![Total Downloads](https://camo.githubusercontent.com/ffec39e8dd730105d57cd7052cf37de22862014c7c0cd6990ad09f98b40cf8c1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6865696d7269636868616e6e6f742f636f6e74616f2d656e636f72652d62756e646c652e737667)](https://packagist.org/packages/heimrichhannot/contao-encore-bundle)[![CI](https://github.com/heimrichhannot/contao-encore-bundle/workflows/CI/badge.svg)](https://github.com/heimrichhannot/contao-encore-bundle/workflows/CI/badge.svg)[![Coverage Status](https://camo.githubusercontent.com/2006c5262855aeb05c93a916688eaa33f0842d52560c64915790a0f575664458/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6865696d7269636868616e6e6f742f636f6e74616f2d656e636f72652d62756e646c652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/heimrichhannot/contao-encore-bundle?branch=master)[![](https://camo.githubusercontent.com/1cb338f256e1610566494abec8388c8b5956ec14d67e93a698a0e0e3f43fa2f8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230342d627269676874677265656e2e7376673f7374796c653d666c6174)](https://camo.githubusercontent.com/1cb338f256e1610566494abec8388c8b5956ec14d67e93a698a0e0e3f43fa2f8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230342d627269676874677265656e2e7376673f7374796c653d666c6174)

Use the power and simplicity of symfony webpack encore in contao. This bundle let you decide on layout and page level, which encore entries should be loaded. If you want more, you can prepare your bundles define their own encore entries, so never need to manually add or remove encore entries again.

Features
--------

[](#features)

- use symfony encore ([symfony/webpack-encore](https://github.com/symfony/webpack-encore) and [symfony/webpack-encore-bundle](https://github.com/symfony/webpack-encore-bundle)) to enhance your contao assets workflow
- conditionally load your assets only if necessary (entrypoints can be activated in the backend in layout and page setting or added from your bundle code (e.g. in a frontend module))
- prepare your bundles to add encore entries when install them and strip assets from the contao global asset arrays

Setup
-----

[](#setup)

### Prerequisites

[](#prerequisites)

- Read the [Encore Documentation](https://symfony.com/doc/current/frontend.html) in order to install Encore and understand the core concepts of Webpack and Symfony Encore.

### Prepare your project and bundle

[](#prepare-your-project-and-bundle)

Setup your project for encore bundle:

➡️ [Project setup](docs/setup_project.md)

➡️ [Bundle setup](docs/setup_bundle.md)

### Run Encore

[](#run-encore)

1. Run encore prepare command

    ```
    php vendor/bin/contao-console huh:encore:prepare

    ```
2. If (yarn) dependencies have changed, run yan install

    ```
    yarn install

    ```
3. Run encore to generate the assets

    ```
    yarn encore dev

    ```
4. Activate encore entries in the contao backend (if not added from code)

Usage
-----

[](#usage)

### Activate encore entries

[](#activate-encore-entries)

1. In the contao backend, go to page layout configuration
2. Check "Activate Webpack Encore" and fill the mandatory fields
3. If you have a main project bundle entry containing the main stylesheets, add it as active entry, add also all other entries you want to have activated on every page.
4. For page specific features, you can activate additional entries in page setting (site structure).
    - Be aware, that child pages will inherit settings from their parants
    - Pay attention that you check entries as active (if you want them to be loaded)!
    - If you want an already added entry to be not loaded on an specific page, select it as entry and don't check "active".

### Prepare command

[](#prepare-command)

```
php vendor/bin/contao-console huh:encore:prepare

```

The prepare command must be executed after every change to the encore entries configuration, e.g. after a composer update or changes to that configurations in your own code.

The command collect encore entries from all bundle and creates a file called `encore.bundles.js` in your project root. This file contains entries for all contao encore compatible bundles that are added by calling `encoreBundles.addEntries();` in your `webpack.config.js`.

It also collects the dependencies from the `package.json` files of bundles have EncoreExtensions registered and adds them to the project dependencies.

```
Description:
  Does the necessary preparation for contao encore bundle. Needs to be called after changes to bundle encore entries.

Usage:
  huh:encore:prepare [options]
  encore:prepare

Options:
      --skip-entries[=SKIP-ENTRIES]  Add a comma separated list of entries to skip their generation. [default: false]

```

### Run encore

[](#run-encore-1)

Run encore to generate/compile your assets.

```
yarn encore dev
yarn encore dev --watch
yarn encore prod

```

Documentation
-------------

[](#documentation)

[Project setup](docs/setup_project.md) - Prepare your contao project for use with encore and encore bundle

[Bundle setup](docs/setup_bundle.md) - Add encore bundle support to your bundle

[Setup Javascript](docs/setup_javascript.md) - Help about setting up your encore entries

[Developer Documentation](docs/developers.md)

[Configuration Reference](docs/configuration.md)

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance59

Moderate activity, may be stable

Popularity34

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 96.3% 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 ~28 days

Recently: every ~116 days

Total

82

Last Release

465d ago

Major Versions

0.8.3 → 1.0.02019-05-15

v1.x-dev → 2.0.0-beta2023-10-31

PHP version history (5 changes)0.1.0PHP ^7.1

1.12.1PHP ^7.1|^8.0

1.15.0PHP ^7.1||^8.0

1.16.0PHP ^7.4 || ^8.0

2.0.0-betaPHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/28ad3224d8727b622ebd229840eea6b9dbcb83eb0bd609e6ce65b614830ff538?d=identicon)[digitales@heimrich-hannot.de](/maintainers/digitales@heimrich-hannot.de)

---

Top Contributors

[![koertho](https://avatars.githubusercontent.com/u/12064642?v=4)](https://github.com/koertho "koertho (183 commits)")[![ericges](https://avatars.githubusercontent.com/u/25957923?v=4)](https://github.com/ericges "ericges (3 commits)")[![leonexcc](https://avatars.githubusercontent.com/u/7428636?v=4)](https://github.com/leonexcc "leonexcc (3 commits)")[![fatcrobat](https://avatars.githubusercontent.com/u/480054?v=4)](https://github.com/fatcrobat "fatcrobat (1 commits)")

---

Tags

contaocontao5symfony-encorewebpack

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/heimrichhannot-contao-encore-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/heimrichhannot-contao-encore-bundle/health.svg)](https://phpackages.com/packages/heimrichhannot-contao-encore-bundle)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)

PHPackages © 2026

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