PHPackages                             maba/webpack-migration-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. maba/webpack-migration-bundle

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

maba/webpack-migration-bundle
=============================

Bundle to Help Migrating From Assetic to Webpack

0.2.0(9y ago)52228[1 PRs](https://github.com/mariusbalcytis/webpack-migration-bundle/pulls)MITPHPPHP &gt;=5.3.2

Since Dec 8Pushed 6y ago2 watchersCompare

[ Source](https://github.com/mariusbalcytis/webpack-migration-bundle)[ Packagist](https://packagist.org/packages/maba/webpack-migration-bundle)[ RSS](/packages/maba-webpack-migration-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (3)Used By (0)

Bundle to Help Migrating From Assetic to Webpack
================================================

[](#bundle-to-help-migrating-from-assetic-to-webpack)

Bundle to help integrating from [assetic](https://github.com/kriswallsmith/assetic)to [webpack](https://webpack.github.io/).

It uses [maba/webpack-bundle](https://github.com/mariusbalcytis/webpack-bundle) and [symfony/assetic-bundle](https://github.com/symfony/assetic-bundle) as dependencies.

It creates and **modifies** files in your repository. This means that it is not meant to be run in production - install it, use it and remove it from your project. Always keep sure to use version system like git and have no uncommitted changes as you might loose your stuff.

What is webpack and why to migrate from assetic?
------------------------------------------------

[](#what-is-webpack-and-why-to-migrate-from-assetic)

Webpack is module bundler and CommonJS / AMD dependency manager.

For me, it replaces both grunt/gulp and RequireJS.

See [what is webpack?](http://webpack.github.io/docs/what-is-webpack.html)and [it's documentation](http://webpack.github.io/docs/) for more information.

For comparison with assetic and alternative webpack-based solutions, see [maba/webpack-bundle](https://github.com/mariusbalcytis/webpack-bundle).

What does this bundle do?
-------------------------

[](#what-does-this-bundle-do)

1. Finds assetic nodes (`stylesheets` and `javascripts` nodes) in your twig templates.
2. Dumps `js` files representing bundled assets.
3. Replaces them with `webpack_asset` function with reference to dumped file.
4. Dumps configured named assets inside `config.yml`.

[twig-template-modification-bundle](https://github.com/mariusbalcytis/twig-template-modification-bundle)is used for replacing the twig templates themselves.

Worth to note that it **does** support assetic variables, but as the result is usable, it's not really manageable in the long scale. Please see other means to accomplish this with conditional loading from the javascript itself. See [symfony-webpack-angular-demo](https://github.com/mariusbalcytis/symfony-webpack-angular-demo) for an example how this could be done with locales.

Also worth to note that it **ignores** `images` assetic nodes and other nodes with unrecognised filters. You can configure ignored filters in `config.yml` by providing `maba_webpack_migration.ignored_filters` parameter.

By default, these filters are ignored:

- cssrewrite
- less
- lessphp
- scssphp
- sassphp
- jsqueeze
- uglifyjs
- uglifyjs2
- uglifycss
- yui\_css
- yui\_js

They are ignored, as `js` and `css` files are minified by default on production, and SCSS and Less files work out of the box. Assumption is made that you use correct extension for your file types (`.less` for Less files etc.)

Installation and Usage
----------------------

[](#installation-and-usage)

```
composer require maba/webpack-migration-bundle
```

Inside `AppKernel`:

```
new Maba\Bundle\WebpackBundle\MabaWebpackBundle(),  // if you don't have it already
new Maba\Bundle\WebpackBundle\MabaTwigTemplateModificationBundle(), // dependency
new Maba\Bundle\WebpackBundle\MabaWebpackMigrationBundle(),
```

Setup files for webpack bundle (see [maba/webpack-bundle](https://github.com/mariusbalcytis/webpack-bundle) for more information what this does):

```
app/console maba:webpack:setup
```

Configure webpack to extract CSS into separate files. This is needed for `stylesheets` tags to work.

```
maba_webpack:
    config:
        parameters:
            extract_css: true
```

Install npm dependencies used by WebpackMigrationBundle which are not installed by default in WebpackBundle:

```
npm install imports-loader exports-loader expose-loader --save-dev
```

In webpack context, `this` is not `window` like when adding common `` tag, `this` points to `module.exports`. This is handled by default by most libraries and when running in such mode, no variables are registered in global context (`window`), they are just exported in CommonJS way.

This breaks things, as your current code expects to find `jQuery`, `angular` etc. in global context.

This bundle analyses JavaScript file for common patterns and tries to use correct loaders to fix these issues. This might not always work out-of-the-box. You can always use additional loader or modify the generated code - bundle only creates and replaces files in your repository, all other modifications to the code after that can be made manually.

Run replacement command:

```
app/console maba:webpack-migration:modify-twig-templates
```

Now your twig files are modified - you can safely remove both bundles (this one and MabaTwigTemplateModificationBundle) from your kernel and vendors. You can just revert your changes in `AppKernel.php`, `composer.json` and `composer.lock`, asserting that you've installed MabaWebpackBundle separately.

Running tests
-------------

[](#running-tests)

[![Travis status](https://camo.githubusercontent.com/df6727bb1f74909da4b82eb729e13dab589fa55622a85af4154a919a3445c373/68747470733a2f2f7472617669732d63692e6f72672f6d617269757362616c63797469732f7765627061636b2d6d6967726174696f6e2d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mariusbalcytis/webpack-migration-bundle)

```
composer install
vendor/bin/phpunit
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity49

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 ~185 days

Total

2

Last Release

3619d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e131c9aa5f5a4fc3cc2f5e01b377ef33bbc3468acc95ff890fc6e8353d9cf67?d=identicon)[mariusbalcytis](/maintainers/mariusbalcytis)

---

Top Contributors

[![mariusbalcytis](https://avatars.githubusercontent.com/u/1590072?v=4)](https://github.com/mariusbalcytis "mariusbalcytis (1 commits)")

---

Tags

symfonySymfony2asseticassetsamdwebpackcommonjs

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/maba-webpack-migration-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/maba-webpack-migration-bundle/health.svg)](https://phpackages.com/packages/maba-webpack-migration-bundle)
```

###  Alternatives

[maba/webpack-bundle

Bundle to Integrate Webpack to Symfony

123268.2k4](/packages/maba-webpack-bundle)[aws/aws-sdk-php-symfony

A Symfony bundle for v3 of the AWS SDK for PHP

36517.7M22](/packages/aws-aws-sdk-php-symfony)[winzou/state-machine-bundle

Bundle for the very lightweight yet powerful PHP state machine

34010.4M15](/packages/winzou-state-machine-bundle)[pentatrion/vite-bundle

Vite integration for your Symfony app

2725.3M13](/packages/pentatrion-vite-bundle)[stfalcon/tinymce-bundle

This Bundle integrates TinyMCE WYSIWYG editor into a Symfony2 project.

2692.9M24](/packages/stfalcon-tinymce-bundle)[jbtronics/settings-bundle

A symfony bundle to easily create typesafe, user-configurable settings for symfony applications

9546.7k2](/packages/jbtronics-settings-bundle)

PHPackages © 2026

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