Skip to main content

Symfony assets management: assetic:dump

!!! Warning: this post is almost 8 years old and was written when using previous versions of Symony, so it may not apply to current versions. Let us know if it does not work for you.

I recently wrote about the assets:install command, but there’s a more interesting way to handle your assets: Assetic.

The Assetic bundle

You can add the Assetic bundle to your project with the following composer command:

composer require symfony/assetic-bundle

P.S. this command offers more options but this is not the place to talk about composer.

This bundle offers advanced assets management features, like minifying or compiling assets and optimizing images. This is done through filters.

One of the key feature of Assetic is that the “real” assets used by your frontend are dynamically generated, i.e. they do not normally exist anywhere on the disc.


Generating assets dynamically can be quite slow, especially when you have many filters; so it is only enabled by default on the DEV environment.

On PROD, the app expects to find real files on the disc.

This is when you use assetic:dump.

It will search for all assets handled by Assetic, generate them, and save them as real files.

Once again, you have to do this if you want to see latest changes on your PROD environment.

How to use Assetic in your layouts

Basically, it boils down to three twig tags:

  • {% javascripts %}…{% endjavascripts %}
  • {% stylesheets %}…{% endstylesheets %}
  • {% image %}…{% endimage %}

For more information about all the available options and filters, you can read the official documentation at


Now you see why you sometimes may find yourself using assets:install and sometimes the assetic:dump.

Of course it’s probably simpler to choose just one method to include assets in layouts, but I don’t see much harm in using both: just be sure you and your team mates know about this!