Skip to content

Commit e202561

Browse files
committed
minor #1292 Move JavaScript entry function in the HTML head (Antoine Makdessi)
This PR was merged into the main branch. Discussion ---------- Move JavaScript entry function in the HTML head Ref https://symfony.com/doc/current/frontend/encore/simple-example.html#configuring-encore-webpack Commits ------- 81afbd4 Move JavaScript entry function in the HTML head
2 parents 5467857 + 81afbd4 commit e202561

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

templates/base.html.twig

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,17 @@
1010
<meta name="viewport" content="width=device-width, initial-scale=1"/>
1111
<title>{% block title %}Symfony Demo application{% endblock %}</title>
1212
<link rel="alternate" type="application/rss+xml" title="{{ 'rss.title'|trans }}" href="{{ path('blog_rss') }}">
13+
14+
{#
15+
Those two blocks defines frontend entrypoint for CSS and JavaScript assets
16+
See https://symfony.com/doc/current/frontend.html
17+
#}
1318
{% block stylesheets %}
1419
{{ encore_entry_link_tags('app') }}
1520
{% endblock %}
21+
{% block javascripts %}
22+
{{ encore_entry_script_tags('app') }}
23+
{% endblock %}
1624

1725
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
1826
</head>
@@ -150,10 +158,6 @@
150158
</footer>
151159
{% endblock %}
152160

153-
{% block javascripts %}
154-
{{ encore_entry_script_tags('app') }}
155-
{% endblock %}
156-
157161
{# it's not mandatory to set the timezone in localizeddate(). This is done to
158162
avoid errors when the 'intl' PHP extension is not available and the application
159163
is forced to use the limited "intl polyfill", which only supports UTC and GMT #}

0 commit comments

Comments
 (0)