Skip to content

Conversation

@smnandre
Copy link
Member

Hello,

this PR adds new features to the Stimulus controller maker (and updates minor things)

  • Add "default" methods (initialize, connect, disconnect) in generated code, with explanation of what they do and example of usage, to encourage good practices for event listeners
  • Add cli option --typescript (shorcut: -ts) to choose extension from command line
  • Add feature to generate classes attributes interactively
  • Add code usage example at the end, to avoid (frequent) mistakes with data attribute placement or markup
  • Cover new features with tests

Also

  • Fix documentation links (StimulusBridge -> StimulusBundle)
  • Set Javascript as default extension in interactive step
  • Add missing tests for values

Most of things here are based on feedback received or mistakes seen frequently... but everything is of course very open to debate and suggestions 🤗

I tried to make a clean commit history to ease review, but if you do want, i can split this PR.

PS: I intentionally did not add outlets to this maker. They are a very advanced feature that can often lead to debatable choices in terms of component architecture, isolation, and more.

@smnandre smnandre changed the title [Stimulus] Make controller with classes, generate usage code, fix doc, add tests [make:stimulus-controller] Add classes support, generate usage code, fix doc, add tests Dec 25, 2024
@kbond kbond merged commit 881ecf0 into symfony:main Jan 24, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants