@@ -5,10 +5,7 @@ After :doc:`installing Encore </frontend/encore/installation>`, your app already
5
5
has a few files, organized into an ``assets/ `` directory:
6
6
7
7
* ``assets/app.js ``
8
- * ``assets/bootstrap.js ``
9
- * ``assets/controllers.json ``
10
8
* ``assets/styles/app.css ``
11
- * ``assets/controllers/hello_controller.js ``
12
9
13
10
With Encore, think of your ``app.js `` file like a standalone JavaScript
14
11
application: it will *require * all of the dependencies it needs (e.g. jQuery or React),
@@ -27,9 +24,6 @@ statements and create one final ``app.js`` (and ``app.css``) that contains *ever
27
24
your app needs. Encore can do a lot more: minify files, pre-process Sass/LESS,
28
25
support React, Vue.js, etc.
29
26
30
- The other files - ``bootstrap.js ``, ``controllers.json `` and ``hello_controller.js ``
31
- relate to a topic you'll learn about soon: `Stimulus & Symfony UX `_.
32
-
33
27
Configuring Encore/Webpack
34
28
--------------------------
35
29
@@ -222,10 +216,18 @@ easy to attach behavior to HTML. It's powerful, and you will love it! Symfony
222
216
even provides packages to add more features to Stimulus. These are called the
223
217
Symfony UX Packages.
224
218
225
- If you followed the setup instructions, you should already have Stimulus installed
226
- and ready to go! In fact, that's the purpose of the ``assets/bootstrap.js `` file:
227
- to initialize Stimulus and automatically load any "controllers" from the
228
- ``assets/controllers/ `` directory.
219
+ To use Stimulus, first install StimulusBundle:
220
+
221
+ .. code-block :: terminal
222
+
223
+ $ composer require symfony/stimulus-bundle
224
+
225
+ The Flex recipe should add several files/directories:
226
+
227
+ * ``assets/bootstrap.js `` - initializes Stimulus;
228
+ * ``assets/controllers/ `` - a directory where you'll put your Stimulus controllers;
229
+ * ``assets/controllers.json `` - file that helps load Stimulus controllers form UX
230
+ packages that you'll install.
229
231
230
232
Let's look at a simple Stimulus example. In a Twig template, suppose you have:
231
233
0 commit comments