My take on HTMX with ASP.NET Core
Вставка
- Опубліковано 8 чер 2024
- Working examples of using HTMX with ASP.NET Core.
Source: github.com/T0shik/HyperTextEx...
Khalid's work: www.jetbrains.com/dotnet/guid...
HTMX: htmx.org/
Support my Work 🤝 / raw_coding
Buy my Courses 📚 learning.raw-coding.dev
Buy my Merch 🛒 shop.raw-coding.dev
Join the Community 💬 / discord
Tweet Tweet 📣 / anton_t0shik
Tune in LIVE! 🎥 / raw_coding
#csharp #htmx #aspnetcore
I wish Anton saw how many LOCs Todo app in Svelte has.
Alright there big man, write it up and drop a link to source. Make sure it has a backend to persist state.
1 year ago I built an app with AlpineJS and HTMX, it was an amazing experience even if a little hard to figure out at first.
Can this be combined with Razor, to use similar to JSX components?
I might try this library out. Thank you. It could save me a lot of time.
Let me know how it goes
I have (jQuery + MVC) PTSD looking at this
it was the best
@@RawCoding are you building something like the the vue h() vnode constructor to be able to write a new templating syntax for c# ?
Well... seems I'm not that crazy. I've been working on and off on generating HTML and what should happen when the user interacts with that HTML server side using just C# for a few months now. I was using JQuery, but I want to try and not use any JS or C# libraries so it would be easy to transfer the idea/logic over to any language.
My goal is to specify what I want and what it should do in code using simple objects. Then have it generate the whole page at load or just bits and pieces as the user uses the app. Much like you are doing here. This has proved to be really fast thanks in large part to not having a framework and no templates which rely on some form of find and replace logic. I just define what I want in code and it gets generated using the dumbest and simplest way I can think of without the use of any library.
My stuff is still very very rough mainly due pretty much all of it being created from scratch (including dealing with client side logic) while your HTML generating seems quite polished. I'm considering HTMX as it will makes things so much easier, but then I'd be relying on another library which is something I want to try and avoid. I want to build a small app with it and see how that goes.
Let me know how it goes!
Backend devs are trying to kill JS/TS by any means necessary 😂. If it's not by using web assembly, it's by going back to stateless html generated by the backend.
Frontend devs are replying with serverside components and server actions aka Nextjs. And others are escaping js quirks with compilers/transpilers aka svelte or imba
World Web War
We have to come together!
2 years ago I was team react.
Last year I became team svelte.
Now I am team SolidJS.
Shouldn’t everyone just create their own framework or something 🤣
Hey 👋 @@SharafMansour do you use the SolidStart meta-framework with it or do you still use a c# backend? Btw before React, you were team Blazor 😉
@@yourockst0ne I still use blazor, and I am currently learning solid start. I am also up to date with svelte kit. The idea of naming the file +page.server.JS makes the code run server side is pretty insane
What's the value this brings? All I see is another library to abstract HTML, CSS and JS. What am I missing? I genuinely want to know.
if you have a json string, you need to parse it to work with it.
HyperTextExpression allows you to express html in data structures which can be manipulated (as if you parsed html in to an XmlDocument)
why that's useful? I can build a skeleton of a website, pass it through different functions and that will generate themed variations.
data data data
When I picked up htmx, I didn't want to go back to thinking in terms of razor pages & handlers & partials etc... I wanted to generate html and return it from minimal api endpoints.
@@RawCoding thanks for this feedback. Much appreciated. I'll read more about it
It is inspired by Flutter?
hiccup
@@RawCoding I see why he's asking, but I see what you are doing. It's like the ".NET MAUI Markup Community Toolkit" with their extension methods, they are trying to get rid of XAML to write UIs.
I really like your library but I think it's a bit verbose. If only it had a declarative syntax like JSX it'd be perfect. Is your library open source?
I agree, not sure how to do that with c# though.
and yeah you can find it here: github.com/T0shik/HyperTextExpression
Man , i will never try this 😂
Me neither lol
lool same here@@meetingattender8132
seeing this remindes me of html and php in one file
holy man please use dark mode
lmao, change underwear
😂😂😂
Rip separation of concern
Rip understanding separation of concerns
Lol@@RawCoding
spaghetti code@@RawCoding
I really love how web development has come full circle from seperation of concern to whatever this is 🙄🙄
You can thank that damn Javascript for that.
"whatever this is" is what the definition of REST api is
Abstracting HTML (and CSS/JS) behind a bunch of proprietary extension methods that I have to learn from scratch: yeah, right. Razor (or just pure SPA with REST backend) is light years better than this.
htmx4life
FIRST!!!!! IM FIRST IM FIRST!!!
🍪