Skip to content

Commit 3e890d7

Browse files
committed
List of package.json controller options
1 parent 94f32d5 commit 3e890d7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

frontend/create_ux_bundle.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,20 @@ Twig ``stimulus_*`` functions.
120120
of the controller in ``package.json`` is ``slug``. So, the full controller name for Stimulus will be
121121
``acme--feature--slug``, though with the ``stimulus_controller()`` function, you can use ``acme/feature/slug``.
122122

123+
Each controller has a number of options in ``package.json`` file:
124+
125+
================== ====================================================================================================
126+
Option Description
127+
================== ====================================================================================================
128+
enabled Whether the controller should be enabled by default.
129+
main Path to the controller file.
130+
fetch How controller & dependencies are included when the page loads.
131+
Use ``eager`` (default) to make controller & dependencies included in the JavaScript that's
132+
downloaded when the page is loaded.
133+
Use ``lazy`` to make controller & dependencies isolated into a separate file and only downloaded
134+
asynchronously if (and when) the data-controller HTML appears on the page.
135+
autoimport List of files to be imported with the controller. Useful e.g. when there are several CSS styles
136+
depending on the frontend framework used (like Bootstrap 4 or 5, Tailwind CSS...).
137+
The value must be an object with files as keys, and a boolean as value for each file to set
138+
whether the file should be imported.
139+
================== ====================================================================================================

0 commit comments

Comments
 (0)