You are browsing the Symfony 4 documentation, which changes significantly from Symfony 3.x. If your app doesn't use Symfony 4 yet, browse the Symfony 3.4 documentation.

Web Assets

Web AssetsΒΆ

Web assets are things like CSS, JavaScript and image files that make the frontend of your site look and work great.

Best Practice

Best Practice

Store your assets in the assets/ directory at the root of your project.

Your designers' and front-end developers' lives will be much easier if all the application assets are in one central location.

Best Practice

Best Practice

Use Webpack Encore to compile, combine and minimize web assets.

Webpack is the leading JavaScript module bundler that compiles, transforms and packages assets for usage in a browser. Webpack Encore is a JavaScript library that gets rid of most of Webpack complexity without hiding any of its features or distorting its usage and philosophy.

Webpack Encore was designed to bridge the gap between Symfony applications and the JavaScript-based tools used in modern web applications. Check out the official Webpack Encore documentation to learn more about all the available features.

Next: Tests

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.