I have been wondering if it is possible to add a parameter for the asset twig function like this
#config.yml
...
framework:
templating:
parameters:
key: value
OR
twig:
parameters:
key: value
...
And in the twig file use asset like this
# twig file
<script src="{{ asset('/file/path', key) }}"></script>
And will regenerate
<script src="/file/path?key=value"></script>
I know i can create a macro to do this but i want to know if there are another way.
Thank for your reply
Assets are generally static files and not dynamic scripts, are you sure you’re doing the right thing? If you have an asset that accepts a parameter maybe it should be a in a controller with a route defined so you can act on it within code and a
{{ path('...', {key: value}) }}Otherwise, The only thing assetic lets you do is auto-append a version number to assets using assets_version