Hi ,
in the parent theme I’ve got this line of code: {% do assets.add('theme://js/singlepagenav.min.js') %}
I’d like to remove this in my child theme.
Could you please tell me how to do this?
Thanks,
Mark
Hi ,
in the parent theme I’ve got this line of code: {% do assets.add('theme://js/singlepagenav.min.js') %}
I’d like to remove this in my child theme.
Could you please tell me how to do this?
Thanks,
Mark
@mark-s, Never used it but maybe assets.removeJs()
is what you are looking for:
See API on Asset Manager:
removeJs( string $key ) : \Grav\Common$this
Removes an item from the JS array if set
Not sure how you are overriding the parent themes templates, but not adding the specific js file to the Asset Manager will do.
Thank you. Do you know, how to get the key for this function? Or what a key looks like? I have only got the MD5 hashed key.
@mark-s, Although I’ve never used it, it sounds logical to me that the file reference used in assets.addJs('<file reference>', options)
, should also be used to remove it.
You can find it in the parent theme’s template, or plugin’s template.
Thanks a lot! It’s working.
{% extends '@quark/modular.html.twig' %}
{% block javascripts %}
{{ parent() }}
{% do assets.removeJS('theme://js/singlepagenav.min.js') %}
{% endblock %}