Skip to content

Commit a66381a

Browse files
committed
minor #60 Update README.md (94noni)
This PR was merged into the main branch. Discussion ---------- Update README.md | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Tickets | | License | MIT I was trying this feature on a small project, and thus proposing this PR Reference to https://symfony.com/blog/moving-script-inside-head-and-the-defer-attribute Commits ------- 40133a3 Update README.md
2 parents 536e836 + 40133a3 commit a66381a

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/Swup/README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ The main usage of Symfony UX Swup is to use its Stimulus controller to initializ
3838
<html lang="en">
3939
<head>
4040
<title>Swup</title>
41+
42+
{% block javascripts %}
43+
{{ encore_entry_script_tags('app') }}
44+
{% endblock %}
4145
</head>
4246
<body data-controller="symfony--ux-swup--swup">
4347
{# ... #}
4448
4549
<main id="swup">
4650
{# ... #}
4751
</main>
48-
49-
{% block javascripts %}
50-
{{ encore_entry_script_tags('app') }}
51-
{% endblock %}
5252
</body>
5353
</html>
5454
```
@@ -63,6 +63,10 @@ additional containers, for instance to have a navigation menu that updates when
6363
<html lang="en">
6464
<head>
6565
<title>Swup</title>
66+
67+
{% block javascripts %}
68+
{{ encore_entry_script_tags('app') }}
69+
{% endblock %}
6670
</head>
6771
<body
6872
data-controller="symfony--ux-swup--swup"
@@ -77,10 +81,6 @@ additional containers, for instance to have a navigation menu that updates when
7781
<main id="swup">
7882
{# ... #}
7983
</main>
80-
81-
{% block javascripts %}
82-
{{ encore_entry_script_tags('app') }}
83-
{% endblock %}
8484
</body>
8585
</html>
8686
```
@@ -110,7 +110,7 @@ You can configure several other options using data-attributes on the `body` tag:
110110
Symfony UX Swup allows you to extend its default behavior using a custom Stimulus controller:
111111

112112
```js
113-
// myswup_controller.js
113+
// assets/controllers/myswup_controller.js
114114

115115
import { Controller } from 'stimulus';
116116

@@ -138,6 +138,7 @@ Then in your template, add your controller to the HTML attribute:
138138
<html lang="en">
139139
<head>
140140
<title>Swup</title>
141+
{# ... #}
141142
</head>
142143
<body data-controller="myswup symfony--ux-swup--swup">
143144
{# ... #}

0 commit comments

Comments
 (0)