Hi folks!
What's the best practice for loading styles or scripts only for one special page?
Is it a good idea to extend the javascript block from the base template inside the content block of a different template? It seems to work, but I was wondering if this is the right way to go…
Here's an example:
excerpt base.html.twig
<head>
{% block head %}
<meta charset="utf-8" />
{% block javascripts %}
{# {% do assets.addJs('jquery',101) %} #}
{% endblock %}
{{ assets.js() }}
{% endblock head%}
</head>
excerpt special.html.twig
{% extends 'partials/base.html.twig' %}
{% block content %}
{{ page.content }}
{% block javascripts %}
<script src="special.js"></script>
{% endblock %}
{% endblock %}
Any thoughts on this?