Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages in full color showing how to combine Symfony with Docker, APIs, queues & async tasks, Webpack, Single-Page Applications, etc.

Buy printed version
WARNING: You are browsing the documentation for Symfony 4.0 which is not maintained anymore. Consider upgrading your projects to Symfony 5.1.

Web Assets

4.0 version
Maintained Unmaintained

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

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

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.