Skip to content

Commit 2b41eaf

Browse files
committed
Merge branch '4.4' into 5.2
* 4.4: Adding details about "defer" and legacy jquery
2 parents 38974dd + ff7becc commit 2b41eaf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

frontend/encore/legacy-applications.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,19 @@ The ``global`` variable is a special way of setting things in the ``window``
8787
variable. In a web context, using ``global`` and ``window`` are equivalent,
8888
except that ``window.jQuery`` won't work when using ``autoProvidejQuery()``.
8989
In other words, use ``global``.
90+
91+
Additionally, be sure to set the ``script_attributes.defer`` option to ``false``
92+
in your ``webpack_encore.yaml`` file:
93+
94+
.. code-block:: yaml
95+
96+
# config/packages/webpack_encore.yaml
97+
webpack_encore:
98+
# ...
99+
script_attributes:
100+
defer: false
101+
102+
This will make sure there is *not* a ``defer`` attribute on your ``script``
103+
tags. For more information, see `Moving <script> inside <head> and the "defer" Attribute`_
104+
105+
.. _`Moving <script> inside <head> and the "defer" Attribute`: https://symfony.com/blog/moving-script-inside-head-and-the-defer-attribute

0 commit comments

Comments
 (0)