HTMX integration with Astro (Meta framework) #1425
FlorentDardenne
started this conversation in
Ideas
Replies: 3 comments 3 replies
|
It would be great! I'm building a website using Astro and I really miss some htmx utilities. |
0 replies
|
Hi, It appears to be quite straightforward to integrate htmx into Astro; or are there specific features that you've found aren't available? Basically as long as your "backend" can take in requests and return HTML, optionally with specific headers, it should be good to work with htmx regardless of the language/framework For Astro, this worked for me:
// say_hi.html.js file
export async function get({ params, request }) {
return {
body: 'Hello World',
};
}<!-- content of index.astro's template -->
<main>
<button hx-get="say_hello.html" hx-target="#outcome">Click me</button>
<div id="outcome"></div>
</main>Hope this helps |
1 reply
|
@FlorentDardenne There is https://github.com/xstevenyung/astro-htmx which could be sufficient already. |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I discovered recently Astro and Htmx (yesterday). Two amazing tools for SSR websites !
An implementation htmx/Astro sample should be very interesting package (and a good way to promote Htmx).
Regards,
Florent
All reactions