Answer the question
In order to leave comments, you need to log in
How to use javascript in symfony correctly?
I didn’t find a sensible answer to my question anywhere. How to properly include js in symfony. Let’s say I have a base page, and the “equipment” page inherits it. And the question is this. I have js , which is only needed on the equipment page. And it seems logical it only on it and connect it, but I saw a lot where js is connected only in the base template .. Where is the truth?)
Answer the question
In order to leave comments, you need to log in
twig:
{% extends 'base.html.twig' %}
...
{% block javascripts %}
{{ parent() }}
<script src="{{ asset('build/equipment.js') }}"></script>
{% endblock %}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question