{ "uuid": [ { "value": "24709b5c-4b26-40f3-822c-2e97c4ac99dc" } ], "langcode": [ { "value": "en" } ], "type": [ { "target_id": "daily_email", "target_type": "node_type", "target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7" } ], "revision_timestamp": [ { "value": "2025-04-16T14:12:57+00:00" } ], "revision_uid": [ { "target_type": "user", "target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849" } ], "revision_log": [], "status": [ { "value": true } ], "uid": [ { "target_type": "user", "target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849" } ], "title": [ { "value": "A modest JavaScript framework for the HTML you already have" } ], "created": [ { "value": "2024-11-24T00:00:00+00:00" } ], "changed": [ { "value": "2025-04-16T14:12:57+00:00" } ], "promote": [ { "value": false } ], "sticky": [ { "value": false } ], "default_langcode": [ { "value": true } ], "revision_translation_affected": [ { "value": true } ], "path": [ { "alias": "\/daily\/2024\/11\/24\/a-modest-javascript-framework-for-the-html-you-already-have", "langcode": "en" } ], "body": [ { "value": "\n

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.<\/p>\n\n

After finding it via SymfonyCasts and Symfony UX (I can't remember if Ryan and I discussed it in our podcast episode<\/a>), I like that it works on top of my existing HTML and Twig templates instead of having to rewrite or duplicate all the markup.<\/p>\n\n

You enable and configure it with data attributes like data-controller<\/code> and data-action<\/code> 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.<\/p>\n\n

Having separate controllers also makes it easy to reuse logic in other parts of your application or extract it for use in other projects.<\/p>\n\n

If you want an example of how I've set up stimulus with esbuild, take a look at this GitHub repository<\/a>, or watch the Stimulus course on SymfonyCasts<\/a>.<\/p>\n\n

I skipped the lessons on Stimulus before and didn't try it for a while, but I'm glad I have.<\/p>\n\n ", "format": "full_html", "processed": "\n

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.<\/p>\n\n

After finding it via SymfonyCasts and Symfony UX (I can't remember if Ryan and I discussed it in our podcast episode<\/a>), I like that it works on top of my existing HTML and Twig templates instead of having to rewrite or duplicate all the markup.<\/p>\n\n

You enable and configure it with data attributes like data-controller<\/code> and data-action<\/code> 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.<\/p>\n\n

Having separate controllers also makes it easy to reuse logic in other parts of your application or extract it for use in other projects.<\/p>\n\n

If you want an example of how I've set up stimulus with esbuild, take a look at this GitHub repository<\/a>, or watch the Stimulus course on SymfonyCasts<\/a>.<\/p>\n\n

I skipped the lessons on Stimulus before and didn't try it for a while, but I'm glad I have.<\/p>\n\n ", "summary": null } ], "feeds_item": [ { "imported": "2025-04-16T14:12:57+00:00", "guid": null, "hash": "94e56c536282b8f8a7ff3729376c4e62", "target_type": "feeds_feed", "target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76" } ] }