Asset Management with Assetic

Other topics

Remarks:

The folder for the publicly accessible assets in a standard Symfony3 project is "/web". Assetic uses this folder as root folder for the assets.

Create relative path for asset

<img src="{{ asset('static/images/logo-default.png') }}" alt="Logo"/>

<!--Generates path for the file "/web/static/images/logo-default.png" -->

Create absolute path for asset

<img src="{{ app.request.getSchemeAndHttpHost() ~ asset('static/images/logo-default.png') }}" alt="Logo"/>

<!--Generates path for the file "/web/static/images/logo-default.png" -->

Parameters:

NameExample
Path'static/images/logo/logo-default.png'

Contributors

Topic Id: 6409

Example Ids: 22054,22055

This site is not affiliated with any of the contributors.