Web Assets
Edit this pageWarning: You are browsing the documentation for Symfony 4.2, which is no longer maintained.
Read the updated version of this page for Symfony 6.3 (the current stable version).
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