-
-
Notifications
You must be signed in to change notification settings - Fork 364
Add a note about using raw data attributes as a prefered way #1336
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
I need to check the PR still, but I’m also preferring the direct attributes these days. |
<!-- would render --> | ||
<div data-controller="hello"> | ||
... | ||
</div> |
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.
We should update a bit more, starting with the "Use the Twig functions..." line. Something like:
Then, activate the controller in your HTML:
(show the raw data-controller
example).
Then after, something like:
Optionally, this bundle has a Twig function to render the attribute:
(show the stimulus_controller()
)
src/StimulusBundle/doc/index.rst
Outdated
.. note:: | ||
|
||
Though this bundle provides these helpful functions/filters, it's recommended to | ||
use raw data attributes instead. If you use PhpStorm - you may want to install |
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.
attributes instead, as they're simple enough. If you use...
src/StimulusBundle/doc/index.rst
Outdated
Though this bundle provides these helpful functions/filters, it's recommended to | ||
use raw data attributes instead. If you use PhpStorm - you may want to install | ||
[Stimulus plugin](https://plugins.jetbrains.com/plugin/18940-stimulus) that will | ||
bring you nice autocompletion for them. |
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.
Stimulus plugin to get nice auto-completion for the attributes
@weaverryan done! Thanks for the review! |
|
||
Though this bundle provides these helpful Twig functions/filters, it's | ||
recommended to use raw data attributes instead, as they're simple enough. | ||
If you use PhpStorm IDE - you may want to install |
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 would add this phrase as a tip bloc :)
src/StimulusBundle/doc/index.rst
Outdated
.. note:: | ||
|
||
Though this bundle provides these helpful Twig functions/filters, it's | ||
recommended to use raw data attributes instead, as they're simple enough. |
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.
Perhaps replace « simple enough » with « straight forward » ?
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 second this, it should be the recommended way on doc :)
@94noni thank you for your review, done! |
Thanks Victor! |
Now with the Stimulus plugin autocomplete in PhpStorm it's better to use raw data attributes instead of built-in functions/filters. Normal Stimulus code is more readable and cleaner IMO.