-
-
Notifications
You must be signed in to change notification settings - Fork 364
[LiveComponent] Add informations for AssetMapper and Stimulus #1276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -791,6 +791,22 @@ Want to change the value of a model or even trigger an action from your | |||
own custom JavaScript? No problem, thanks to a JavaScript ``Component`` | |||
object, which is attached to each root component element. | |||
|
|||
Before going any further, check that the controller entry ``@symfony/ux-live-component`` has been added to ``assets/controllers.json``, like this:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I know what goes wrong here. You installed the LiveComponent bundle before the StimulusBundle. This is explained in the doc here https://symfony.com/bundles/ux-live-component/current/index.html#installation :
Before you start, make sure you have [StimulusBundle configured in your app]
But like you, I made the mistake multiple times.
So I don't think we should talk about the assets/controller.json here, but maybe we can add a more detailed section on how to install the Stimulus Bundle directly into this page. Or maybe write something more visual that the StimulusBundle should be installed first. And I wonder if when installing the LiveComponentBundle we can execute the StimulusBundle recipe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be a good idea to give a little more highlight to the message you quote in the documentation.
With AssetMapper | ||
~~~~~~~~~~~~~~~~ | ||
|
||
If you're using AssetMapper, you need to add one new entry to you ``importmap.php``:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here this is part of the StimulusBundle recipe
…le (ker0x) This PR was merged into the 2.x branch. Discussion ---------- [Docs] Add caution alert when bundle require StimulusBundle | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Issues | To complement #1276 | License | MIT This PR add a `caution` alert at the beginning of `Installation` section for all bundle requiring StimulusBundle Commits ------- 743d44a [Docs] Add caution alert when bundle require StimulusBundle
I've just merged a PR to add docs about installing StimulusBundle before LiveComponents (or any other package). Hopefully that will help :). Cheers! |
I tried to reproduce this part of the documentation, without success.
There's no bug, just some missing information in the documentation.
How to reproduce this issue :
Create a webapp project
Install AssetMapper :
composer require symfony/asset-mapper symfony/asset symfony/twig-pack
Install LiveComponent :
composer require symfony/ux-live-component
Install Stimulus :
composer require symfony/ux-live-component
Create a Live component :
foo_controller.js
:importmap.php
:assets/controllers.json
:count
increase to 1 and re-render the component automatically.So I've added a bit of documentation, but please excuse my poor English.