imacrayon

Joined 3 years ago

Karma
52
Submissions
26
Member since
Jan 13
Award-losing web developer & visual artist.

github.com/imacrayon twitter.com/ima_crayon

View on Hacker News

Recent submissions

Comment · 1 year ago
You can swap multiple elements with targeting too: `x-target="comments comments_count"`, but, yeah most of the time `x-sync` is better.
Comment · 1 year ago
This is the way. https://alpine-ajax.js.org provides what’s missing from HTMX.
Comment · 1 year ago
You made my day! thanks
Comment · 1 year ago
This is one reason I created https://alpine-ajax.js.org. A few years ago there were a lot of examples in the HTMX documentation that discouraged accessibility and progressive enhancement. Stuff like like clickable <div>s, ignored keyboard focus, lack of screen reader announcements. There’s been some improvement latel, but I still think the library has a lot of foot guns for new web developers.
Comment · 2 years ago
I actually created https://alpine-ajax.js.org for this reason. HTMX and Hotwire both have opinionated requirements around the content and status codes that your server returns. One of the goals with Alpine AJAX is you should be able to drop it into any basic CRUD app and have it working without changing any server code.

HTMX for example requires that a successful form submission respond with a 200 status, but many applications (most?) will 302 redirect to a new page to prevent duplicate form request on refresh.

Comment · 2 years ago
Comment · 2 years ago
Help me understand why you need the JSON in these examples…You’re rendering JSON data on the frontend just to transform it into HTML. The HTML is rendered server-side, so you should be able to skip the JSON and embed the data in HTML, right? `<input name="firstName" value="John">`
Comment · 2 years ago
Check out https://alpine-ajax.js.org it defaults to using the same template views you would in a typical JavaScript-less app, then you can sprinkle in fragments where you need to optimize requests.
Comment · 2 years ago
You can use https://alpine-ajax.js.org for this, or Alpine can work as an alternative to Stimulus.js in the Hotwire stack.
Comment · 2 years ago
Comment · 2 years ago
Alpine + Alpine AJAX. It's lighter than Alpine + HTMX and it doesn't require splitting your templates up into partials.
Comment · 2 years ago
Comment · 2 years ago
Comment · 2 years ago
Oh, absolutely :) I try to keep up on Slack, but I need to get back to going to the in-person events again. It’d be cool to reconnect there sometime!
Comment · 2 years ago
I’m impressed with how thorough this is! It’s cool insight into the dev conference experience.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton