Skip to content

Updating {% block javascripts position to match recipe change #14836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .doctor-rst.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ whitelist:
- 'The bin/console Command'
- '# username is your full Gmail or Google Apps email address'
- '.. _`LDAP injection`: http://projects.webappsec.org/w/page/13246947/LDAP%20Injection'
- '.. versionadded:: 0.21.0' # Encore
- '.. versionadded:: 1.9.0' # Encore
- '.. versionadded:: 0.28.4' # Encore
- '.. versionadded:: 2.4.0' # SwiftMailer
- '.. versionadded:: 1.30' # Twig
Expand Down
24 changes: 14 additions & 10 deletions frontend/encore/simple-example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,18 @@ can do most of the work for you:
<!-- Renders a link tag (if your module requires any CSS)
<link rel="stylesheet" href="/build/app.css"> -->
{% endblock %}
</head>
<body>
<!-- ... -->

{% block javascripts %}
{{ encore_entry_script_tags('app') }}

<!-- Renders app.js & a webpack runtime.js file
<script src="/build/runtime.js"></script>
<script src="/build/app.js"></script> -->
<script src="/build/runtime.js" defer></script>
<script src="/build/app.js" defer></script>
See note below about the "defer" attribute -->
{% endblock %}
</body>
</head>

<!-- ... -->
</html>

.. _encore-entrypointsjson-simple-description:
Expand All @@ -135,11 +135,14 @@ If you're *not* using Symfony, you can ignore the ``entrypoints.json`` file and
point to the final, built file directly. ``entrypoints.json`` is only required for
some optional features.

.. versionadded:: 0.21.0
.. versionadded:: 1.9.0

The ``encore_entry_link_tags()`` comes from WebpackEncoreBundle and relies
on a feature in Encore that was first introduced in version 0.21.0. Previously,
the ``asset()`` function was used to point directly to the file.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old note had probably been there long enough - so I just replaced it with the new one

The ``defer`` attribute on the ``script`` tags delays the execution of the
JavaScript until the page loads (similar to putting the ``script`` at the
bottom of the page). The ability to always add this attribute was introduced
in WebpackEncoreBundle 1.9.0 and is automatically enabled in that bundle's
recipe in the ``config/packages/webpack_encore.yaml`` file. See
`WebpackEncoreBundle Configuration`_ for more details.

Requiring JavaScript Modules
----------------------------
Expand Down Expand Up @@ -355,3 +358,4 @@ Encore supports many more features! For a full list of what you can do, see

.. _`Encore's index.js file`: https://github.com/symfony/webpack-encore/blob/master/index.js
.. _`ECMAScript 6 modules`: https://hacks.mozilla.org/2015/08/es6-in-depth-modules/
.. _`WebpackEncoreBundle Configuration`: https://github.com/symfony/webpack-encore-bundle#configuration
2 changes: 1 addition & 1 deletion introduction/from_flat_php_to_symfony.rst
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,10 @@ The ``layout.php`` file is nearly identical:
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
{% block javascripts %}{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
</body>
</html>

Expand Down