@@ -168,8 +168,8 @@ a subdirectory, the *name* will be ``subdirectory:icon_name``.
168
168
On-Demand Open Source Icons
169
169
~~~~~~~~~~~~~~~~~~~~~~~~~~~
170
170
Add your SVG icons to the ``assets/icons/ `` directory and commit them.
171
- The name of the file is used as the _name_ of the icon (``name.svg `` will be named ``name ``).
172
- If located in a subdirectory, the _name_ will be ``sub-dir:name ``.
171
+ The name of the file is used as the * name * of the icon (``name.svg `` will be named ``name ``).
172
+ If located in a subdirectory, the * name * will be ``sub-dir:name ``.
173
173
174
174
.. code-block :: text
175
175
@@ -243,13 +243,18 @@ the ``assets/icons/`` directory. You can think of importing an icon as *locking
243
243
Rendering Icons
244
244
---------------
245
245
246
- .. code-block :: html+ twig
246
+ .. code-block :: twig
247
247
248
- {{ ux_icon('user-profile', {class: 'w-4 h-4'}) }} <!-- renders "user-profile.svg" -->
248
+ {# includes the contents of the 'assets/icons/user-profile.svg' file in the template #}
249
+ {{ ux_icon('user-profile') }}
249
250
250
- {{ ux_icon('sub-dir:user-profile', {class: 'w-4 h-4'}) }} <!-- renders "sub-dir/user-profile.svg" (sub-directory) -->
251
+ {# icons stored in subdirectories must use the 'subdirectory_name:file_name' syntax
252
+ (e.g. this includes 'assets/icons/admin/user-profile.svg') #}
253
+ {{ ux_icon('admin:user-profile') }}
251
254
252
- {{ ux_icon('flowbite:user-solid') }} <!-- renders "flowbite:user-solid" from ux.symfony.com -->
255
+ {# this downloads the 'user-solid.svg' icon from the 'Flowbite' icon set via ux.symfony.com
256
+ and embeds the downloaded SVG contents in the template #}
257
+ {{ ux_icon('flowbite:user-solid') }}
253
258
254
259
HTML Syntax
255
260
~~~~~~~~~~~
@@ -378,7 +383,7 @@ Caching
378
383
On-Demand VS Import
379
384
^^^^^^^^^^^^^^^^^^^
380
385
381
- While *on-demand * icons are great during development, they require http requests to fetch the icon
386
+ While *on-demand * icons are great during development, they require HTTP requests to fetch the icon
382
387
and always use the *latest version * of the icon. It's possible the icon could change or be removed
383
388
in the future. Additionally, the cache warming process will take significantly longer if using
384
389
many _on-demand _ icons. You can think of importing the icon as *locking it * (similar to how
0 commit comments