@@ -120,7 +120,7 @@ For example, to render all of the ``script`` and ``link`` tags for a specific
120
120
Assuming that ``entry1 `` required two files to be included - ``build/vendor~entry1~entry2.js ``
121
121
and ``build/entry1.js ``, then ``encore_entry_script_tags() `` is equivalent to:
122
122
123
- .. code-block :: twig
123
+ .. code-block :: html+ twig
124
124
125
125
<script src="{{ asset('build/vendor~entry1~entry2.js') }}"></script>
126
126
<script src="{{ asset('build/entry1.js') }}"></script>
@@ -144,12 +144,9 @@ during a single request.
144
144
145
145
In that case, before each render, you'll need to "reset" the internal
146
146
cache so that the bundle re-renders CSS or JS files that it previously
147
- rendered. For example, in a controller:
148
-
149
- .. code-block :: php
147
+ rendered. For example, in a controller::
150
148
151
149
// src/Controller/SomeController.php
152
-
153
150
use Symfony\WebpackEncoreBundle\Asset\EntrypointLookupInterface;
154
151
155
152
class SomeController
@@ -182,9 +179,7 @@ different ways:
182
179
1. When rendering in Twig - see the ``attributes `` option in the docs above.
183
180
184
181
1. By listening to the ``Symfony\WebpackEncoreBundle\Event\RenderAssetTagEvent ``
185
- event. For example:
186
-
187
- .. code-block :: php
182
+ event. For example::
188
183
189
184
namespace App\EventSubscriber;
190
185
@@ -220,7 +215,7 @@ See `stimulus-bridge`_ for more details.
220
215
221
216
For example:
222
217
223
- .. code-block :: twig
218
+ .. code-block :: html+ twig
224
219
225
220
<div {{ stimulus_controller('chart', { 'name': 'Likes', 'data': [1, 2, 3, 4] }) }}>
226
221
Hello
@@ -237,7 +232,7 @@ For example:
237
232
238
233
If you want to set CSS classes:
239
234
240
- .. code-block :: twig
235
+ .. code-block :: html+ twig
241
236
242
237
<div {{ stimulus_controller('chart', { 'name': 'Likes', 'data': [1, 2, 3, 4] }, { 'loading': 'spinner' }) }}>
243
238
Hello
@@ -264,7 +259,7 @@ values are properly escaped (the string ``[`` is an escaped
264
259
265
260
If you have multiple controllers on the same element, you can chain them as there's also a ``stimulus_controller `` filter:
266
261
267
- .. code-block :: twig
262
+ .. code-block :: html+ twig
268
263
269
264
<div {{ stimulus_controller('chart', { 'name': 'Likes' })|stimulus_controller('other-controller') }}>
270
265
Hello
@@ -283,7 +278,7 @@ The ``stimulus_action()`` Twig function can be used to render `Stimulus Actions`
283
278
284
279
For example:
285
280
286
- .. code-block :: twig
281
+ .. code-block :: html+ twig
287
282
288
283
<div {{ stimulus_action('controller', 'method') }}>Hello</div>
289
284
<div {{ stimulus_action('controller', 'method', 'click') }}>Hello</div>
@@ -295,7 +290,7 @@ For example:
295
290
If you have multiple actions and/or methods on the same element, you can chain them as there's also a
296
291
``stimulus_action `` filter:
297
292
298
- .. code-block :: twig
293
+ .. code-block :: html+ twig
299
294
300
295
<div {{ stimulus_action('controller', 'method')|stimulus_action('other-controller', 'test') }}>
301
296
Hello
@@ -314,7 +309,7 @@ You can also retrieve the generated attributes as an array, which can be helpful
314
309
315
310
You can also pass `parameters `_ to actions:
316
311
317
- .. code-block :: twig
312
+ .. code-block :: html+ twig
318
313
319
314
<div {{ stimulus_action('hello-controller', 'method', 'click', { 'count': 3 }) }}>Hello</div>
320
315
@@ -328,7 +323,7 @@ The ``stimulus_target()`` Twig function can be used to render `Stimulus Targets`
328
323
329
324
For example:
330
325
331
- .. code-block :: twig
326
+ .. code-block :: html+ twig
332
327
333
328
<div {{ stimulus_target('controller', 'a-target') }}>Hello</div>
334
329
<div {{ stimulus_target('controller', 'a-target second-target') }}>Hello</div>
@@ -339,7 +334,7 @@ For example:
339
334
340
335
If you have multiple targets on the same element, you can chain them as there's also a `stimulus_target ` filter:
341
336
342
- .. code-block :: twig
337
+ .. code-block :: html+ twig
343
338
344
339
<div {{ stimulus_target('controller', 'a-target')|stimulus_target('other-controller', 'another-target') }}>
345
340
Hello
0 commit comments