Skip to content

Commit d2b6f70

Browse files
committed
Document about alternative JS assets installation with npm packages
1 parent 032aa55 commit d2b6f70

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

assets/README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# @symfony/ux-live-component
22

3-
Live Component: bring server-side re-rendering & model binding to any element.
3+
JavaScript assets of the [symfony/ux-live-component](https://packagist.org/packages/symfony/ux-live-component) PHP package.
44

5-
**ℹ️ Direct installation of this package is for advanced users only.** We strongly recommend installing it through the PHP package [symfony/ux-live-component](https://packagist.org/packages/symfony/ux-live-component) in a Symfony application with Flex enabled.
5+
## Installation
66

7-
If you still want to install this package directly, **make sure its version exactly matches [symfony/ux-live-component](https://packagist.org/packages/symfony/ux-live-component) PHP package version.**
7+
This npm package is **reserved for advanced users** who want to decouple their JavaScript dependencies from their PHP dependencies (e.g., when building Docker images, running JavaScript-only pipelines, etc.).
8+
9+
We **strongly recommend not installing this package directly**, but instead install the PHP package [symfony/ux-live-component](https://packagist.org/packages/symfony/ux-live-component) in your Symfony application with [Flex](https://github.com/symfony/flex) enabled.
10+
11+
If you still want to install this package directly, please make sure its version exactly matches [symfony/ux-live-component](https://packagist.org/packages/symfony/ux-live-component) PHP package version:
12+
```shell
13+
composer require symfony/ux-live-component:2.23.0
14+
npm add @symfony/[email protected]
15+
```
816

917
## Resources
1018

doc/index.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ needed if you're using AssetMapper):
8383
$ npm install --force
8484
$ npm run watch
8585
86+
.. note::
87+
88+
For more complex installation scenarios, you can install the JavaScript assets through the `@symfony/ux-live-component npm package`_
89+
8690
If your project is localized in different languages (either via the `locale route parameter`_
8791
or by `setting the locale in the request`_) add the ``{_locale}`` attribute to
8892
the UX Live Components route definition to keep the locale between re-renders:
@@ -3800,7 +3804,7 @@ uses Symfony's test client to render and make requests to your components::
38003804
// authenticate a user ($user is instance of UserInterface)
38013805
$testComponent->actingAs($user);
38023806

3803-
// set the '_locale' route parameter (if the component route is localized)
3807+
// set the '_locale' route parameter (if the component route is localized)
38043808
$testComponent->setRouteLocale('fr');
38053809

38063810
// customize the test client
@@ -3902,3 +3906,4 @@ promise. However, any internal implementation in the JavaScript files
39023906
.. _`locale route parameter`: https://symfony.com/doc/current/translation.html#the-locale-and-the-url
39033907
.. _`setting the locale in the request`: https://symfony.com/doc/current/translation.html#translation-locale
39043908
.. _`Stimulus action parameter`: https://stimulus.hotwired.dev/reference/actions#action-parameters
3909+
.. _`@symfony/ux-live-component npm package`: https://www.npmjs.com/package/@symfony/ux-live-component

0 commit comments

Comments
 (0)