5 ms·
https://htmx.org/ https://htmx.org/ Having spent 36+ years in the computer industry, I consider the advent of htmx to be the first thing in web development to
by geenat 5y ago
https://htmx.org/ https://htmx.org/
Having spent 36+ years in the computer industry, I consider the advent of htmx to be the first thing in web development to to attempt to pull the industy's head out of it's ass.
Don't forget to include a solid remake of css in your project like tailwindcss. It also makes code much more readable.
- thaumasiotes 5y ago> Read the docs introduction for a more in-depth... introduction. Heh. This reminded me of http://itre.cis.upenn.edu/~myl/languagelog/archives/000012.html http://itre.cis.upenn.edu/~myl/languagelog/archives/000012.h... . "PERSONNEL WHO ARE NOT AUTHORIZED TO BE IN THE HANGAR ARE NOT AUTHORIZED TO BE IN THE HANGAR"
- PaulDavisThe1st 5y agosign seen in Seattle on a housing project in the 90s: ALL ILLEGAL ACTIVITIES ARE PROHIBITED
- thaumasiotes 5y agoThat one's not redundant; it says that illegal activities (in addition to violating the law) also violate the rules of the housing project. That kind of thing is bog-standard in all kinds of contracts, because including a clause like that makes your illegal activity grounds for terminating the contract. (In this case, the prohibition on illegal activities presumably allows the project to evict tenants who are convicted of crimes.)
- lmc 5y agoHow well does it work for complex projects/component libraries? React is a pain in the ass but there's at least some established patterns for large projects.
- fredrikholm 5y agoYou will most likely be using a templating language to re-render the view with new state. If you're lucky your chosen language enables you to do that inlined in your function along with your normal workflow. Otherwise you now have template files, templating logic and domain logic across several files and you're right back where you started (accidental complexity), minus the JS.
- toastercat 5y agoWhat's the difference between this and AlpineJS?
- stanislavb 5y agoI think it's just an alternative https://www.libhunt.com/bigskysoftware/htmx https://www.libhunt.com/bigskysoftware/htmx
- tirpen 5y agoThey solve different problems. Alpine is about defining in-browser behaviours in a nice, simple, declarative way. HTMX is about defining data loading and brower-server interactions in a nice, simple, declarative way. The author of HTMX have often suggested using HTMX and Alpine together for this very reason, they work very well together.
- midrus 5y agoI use Unpoly (equivalent to HTMX for your question) + Alpine and they complement each other very well. Unpoly handles everything that requires what in SPA world would be an "API call", the difference is that the response I get is just the HTML with the data already rendered and which is dynamically updated in the DOM. Also Modals and page transitions Turbolinks style are handled by Unpoly. Alpine handles everything that doesn't require a server API call, such as form wizards steps, dropdowns, tables filtering, sidebars, buttons loading/disabled states, etc. The end result, the application "feels" like Github.
- devmunchies 5y agoWhen fetching from the backend, the docs recommend returning snippets of html instead of JSON. Is it technically valid to return a snippet of HTML with a content type of “text/html”? There’s no standards saying you need !DOCTYPE or a head or body?
- richdougherty 5y agoI guess it's not valid, although the impact might be that big if it's only you calling your own endpoints. If you want to be really correct you could use your own content type under the vendor tree: https://www.rfc-editor.org/rfc/rfc6838#section-3.2 https://www.rfc-editor.org/rfc/rfc6838#section-3.2. E.g. Content-type: application/vnd+yourorg.htmlx+html-snippet
- devmunchies 5y agoSome discussion here https://stackoverflow.com/questions/19303361/content-type-for-html-fragments https://stackoverflow.com/questions/19303361/content-type-fo... Basically that nowadays it’s fine to use text/html for html fragments, because the content is still html, even if it’s not a full document.
- tetraca 5y agoRegardless of whether it is standard or not I've definitely worked on sites that worked this way back in the day. Smarty+PHP would generate the beef of the page, then certain components of the page would be pulled in using Ajax requests as the user did things. The browser would not care.
- Beltalowda 5y agoI still write sites like this. I realize this is not "the way" to do things today by many, but I find it works quite well and it avoids a lot of complexity. I think the "classic" web-apps were given a bit of an undeserved bad rep because a lot were written in bad PHP and bad JavaScript, and people conflated that with "this entire approach is wrong".
- 5y ago
- quickthrower2 5y agoLooks like yet another opinionated web library/framework.
- victor9000 5y agoI have never really understood the purpose of tailwindcss. It's main benefit seems to be that it exposes CSS rules using classes. Then I have to add a mountain of classes to my html. Am I missing something?
- midrus 5y agoA lot. https://blog.jannikwempe.com/debunking-tailwind-counterarguments https://blog.jannikwempe.com/debunking-tailwind-counterargum... https://www.swyx.io/why-tailwind https://www.swyx.io/why-tailwind And many similar ones.
- 5560675260 5y agoIt's for people that hate cascading part of CSS, people that never really took time to learn CSS, and people that got burned by an unmaintainable 5k+ line CSS file so hard that they want to jump to another extreme.
- tonto 5y agowhy do you think after 36 years, its htmx that is changing things
- zabil 5y agoI find writing isolated unit tests tough when using htmx over the wire frameworks like HTMX and HotWire. The options are to mock the server and test the page, which is not exactly unit test. So I am curious is there an easy way to write unit tests for htmx bits of the page?
- nnain 5y agoSame. Testing is an issue. I bought into the Hotwire idea on a recent project. But I can’t see how it’s any different then SSR + jQuery. They have some nice ideas, but it requires every team member to know the whole thing top to down. Backend engineers can’t always be burdened with taking care of HTML/templating/Writing JS specific functions. Feels almost wrong to me at how hard it has been sold.
- midrus 5y agoDon't forget Unpoly! A bit more opinionated and "batteries included" than HTMX, still same ideology. I use it every day and I love it.