Skip to content

Commit 8577834

Browse files
committed
minor #18350 Updating UX docs to install the new StimulusBundle (weaverryan)
This PR was merged into the 5.4 branch. Discussion ---------- Updating UX docs to install the new StimulusBundle Hi! A lot of moving pieces right now in the frontend area. The asset-mapper docs are still coming. But, ignoring asset-mapper, we just released WebpackEncoreBundle 2.0. This has 2 important changes: 1) Its recipe now longer includes the Stimulus files - like controllers.json 2) It no longer includes the Twig `stimulus_` functions. Users now need to install `symfony/stimulus-bundle`. This is a quick change to help the docs reflect that change. Thanks! Commits ------- 815b159 Updating UX docs to install the new StimulusBundle
2 parents 93a056b + 815b159 commit 8577834

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

frontend/encore/simple-example.rst

+12-10
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ After :doc:`installing Encore </frontend/encore/installation>`, your app already
55
has a few files, organized into an ``assets/`` directory:
66

77
* ``assets/app.js``
8-
* ``assets/bootstrap.js``
9-
* ``assets/controllers.json``
108
* ``assets/styles/app.css``
11-
* ``assets/controllers/hello_controller.js``
129

1310
With Encore, think of your ``app.js`` file like a standalone JavaScript
1411
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
2724
your app needs. Encore can do a lot more: minify files, pre-process Sass/LESS,
2825
support React, Vue.js, etc.
2926

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-
3327
Configuring Encore/Webpack
3428
--------------------------
3529

@@ -222,10 +216,18 @@ easy to attach behavior to HTML. It's powerful, and you will love it! Symfony
222216
even provides packages to add more features to Stimulus. These are called the
223217
Symfony UX Packages.
224218

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.
229231

230232
Let's look at a simple Stimulus example. In a Twig template, suppose you have:
231233

0 commit comments

Comments
 (0)