Add daily email for 2024-11-24
A modest JavaScript framework for the HTML you already have
This commit is contained in:
parent
3dfa4e5f1f
commit
db5e93c512
26
source/_daily_emails/2024-11-24.md
Normal file
26
source/_daily_emails/2024-11-24.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
title: A modest JavaScript framework for the HTML you already have
|
||||
date: 2024-11-24
|
||||
permalink: daily/2024/11/24/a-modest-javascript-framework-for-the-html-you-already-have
|
||||
tags:
|
||||
- software-development
|
||||
- javascript
|
||||
- stimulus
|
||||
cta: call
|
||||
snippet: |
|
||||
For the last few projects, I've been using and liking Stimulus - the modest JavaScript framework for the HTML you already have.
|
||||
---
|
||||
|
||||
After starting with jQuery in Drupal 6 and moving to full JavaScript frameworks like Vue, I've recently been using Stimulus when adding JavaScript to my projects.
|
||||
|
||||
After finding it via SymfonyCasts and Symfony UX (I can't remember if Ryan and I discussed it [in our podcast episode][podcast]), I like that it works on top of my existing HTML and Twig templates instead of having to rewrite or duplicate all the markup.
|
||||
|
||||
You enable and configure it with data attributes like `data-controller` and `data-action` in your HTML which refer to separate JavaScript classes and methods, so you have some structure and organisation compared to putting all the logic in Twig.
|
||||
|
||||
Having separate controllers also makes it easy to reuse logic in other parts of your application or extract it for use in other projects.
|
||||
|
||||
If you want an example of how I've set up stimulus with esbuild, [take a look at this GitHub repository](https://github.com/opdavies/stimulus-esbuild-example), or [watch the Stimulus course on SymfonyCasts](https://symfonycasts.com/screencast/stimulus).
|
||||
|
||||
I skipped the lessons on Stimulus before and didn't try it for a while, but I'm glad I have.
|
||||
|
||||
[podcast]: {{site.url}}/podcast/10-ryan-weaver-symfonycasts
|
Loading…
Reference in a new issue