Assets enable you to add CSS, JS, image or other files to your project, to style and customize its look and behavior.
To add assets to the project, provide asset files (such as CSS or JS files)
assets folder, for example under
All asset files must be added to
webpack.config.js in the root folder,
so that Webpack Encore can use them.
To do it, use
Encore.addStyleEntry for CSS files and
Encore.addEntry for other files, such as JS:
1 2 3 4 5 6 7
Include assets in templates¶
To include assets in your templates, add them to the template's
and provide the name of the asset entry you configured in
webpack.config.js, for example:
1 2 3
After you add the asset files, clear the cache and run
yarn encore <dev|prod>.
To include a single asset file in your template, for example an image,
asset() Twig function:
Place the image file in the