Skip to content

Commit 91c0924

Browse files
committed
Removes the stimulus guidelines (it was moved to the stimulus package)
1 parent 4c98f2a commit 91c0924

File tree

1 file changed

+1
-33
lines changed

1 file changed

+1
-33
lines changed

.ai/hotwire.blade.php

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
- Use Turbo Drive for smooth page transitions without full page reloads.
55
- Decompose pages with Turbo Frames for independent sections that update separately.
66
- Use Turbo Streams for real-time updates and dynamic content changes.
7-
- Leverage Stimulus for progressive JavaScript enhancement when Turbo isn't sufficient.
8-
- Keep Stimulus controllers focused and simple
7+
- Leverage Stimulus for progressive JavaScript enhancement when Turbo isn't sufficient (if Stimulus is available)
98
- Prefer server-side template rendering and state management over client-side frameworks.
109
- Enable "morphing" for seamless page updates that preserve scroll position and focus.
1110
- Use data attributes for JavaScript hooks
@@ -127,37 +126,6 @@ class Post extends Model
127126
</code-snippet>
128127
@endverbatim
129128

130-
## Stimulus Integration
131-
- Use Stimulus for client-side interactivity that requires JavaScript (when Turbo's server-side approach isn't sufficient):
132-
@verbatim
133-
<code-snippet name="Stimulus controller for form enhancements" lang="javascript">
134-
import { Controller } from "@hotwired/stimulus"
135-
136-
export default class extends Controller {
137-
static targets = ["input", "counter"]
138-
139-
connect() {
140-
this.updateCounter()
141-
}
142-
143-
updateCounter() {
144-
const length = this.inputTarget.value.length
145-
this.counterTarget.textContent = `${length}/280`
146-
}
147-
}
148-
</code-snippet>
149-
@endverbatim
150-
- Connect Stimulus controllers with proper data attributes:
151-
@verbatim
152-
```blade
153-
<div data-controller="character-counter">
154-
<textarea data-character-counter-target="input"
155-
data-action="input->character-counter#updateCounter"></textarea>
156-
<span data-character-counter-target="counter">0/280</span>
157-
</div>
158-
```
159-
@endverbatim
160-
161129
## Form Handling & Validation
162130
- Use Laravel's resource route naming conventions for automatic form re-rendering, if the matching route exists:
163131
- `*.store` action redirects to `*.create` route (shows form again with validation errors)

0 commit comments

Comments
 (0)