The asset filter (also available as a function, asset()
) generates a URL for an asset using the current scheme of the request (HTTP or HTTPS):
{{ 'img/photo.jpg' | asset }}
{# or #}
{{ asset('img/photo.jpg') }}
See Helpers#asset for more information.