Closed vcastro45 closed 3 years ago
Is this.element.textContent
updated with the new text?
Also, you should probably use a the defer attribute on your script to execute it at the end of the page load.
No, this.element.textContent
is not updated with the new text.
Even with the defer
attribute on the script tag, it still not working.
Did you find the issue? What was it?
I made a mistake: le way I was importing the js and css files was not the good one.
We have to use encore_entry_link_tags
and encore_entry_script_tags
:
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
{% endblock %}
{% block javascripts %}
{{ encore_entry_script_tags('app') }}
{% endblock %}
Just starting a new project with Symfony 4.4 and Webpack Encore: Stimulus is here ! I’ve never used this and it look like it doesn’t works well for me. Is there something wrong in my code ? I juste have a Symfony controller that render
base.html.twig
and this file contains this:and the
hello_controller.js
contains this:In the browser, when I inspect the code, the bundled javascript code is well "rendered" but nothing happen when I click the "Greet" button.