Skip to content

Commit cb199ef

Browse files
weaverryanjaviereguiluz
authored andcommitted
Adding details about "defer" and legacy jquery
1 parent aa3f693 commit cb199ef

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

frontend/encore/legacy-applications.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,18 @@ 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+
script_attributes:
99+
defer: false
100+
101+
This will make sure there is *not* a ``defer`` attribute on your ``script``
102+
tags. For more information, see `Moving <script> inside <head> and the "defer" Attribute`_
103+
104+
.. _`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)