Live data from Hacker News

Htmx – high power tools for HTML

htmx.org

121–130 of 175 posts

Re: Htmx – high power tools for HTML

#121

Earlier quoted context omitted.

Yes, but you shouldn't use it as a simple drop-in. The minified version via CDN is like 1.7 MB ... at least they mention you should not use it in the docs and instead configure it to your needs.

tailwind is 1.7MB of CSS? ....whyy?

It defines css classes for most css properties. Their website [1] explains why you might want that pretty well. Regarding file size, the idea is that you use something like PurgeCSS in your build pipeline, which removes all unused css classes. A bit like tree shaking for css.

[1] https://tailwind.css

Re: Htmx – high power tools for HTML

#122
post #92

Earlier quoted context omitted.

Add tailwind css or another utility class css framework and you can do the whole frontend in html :)

Yes, but you shouldn't use it as a simple drop-in. The minified version via CDN is like 1.7 MB ... at least they mention you should not use it in the docs and instead configure it to your needs.

Indeed, using tailwind without some build pipeline is not recommended. You'd use something like PurgeCSS to remove all unused css classes. Which admittedly kind of defeats the whole idea of keeping it simple.

Re: Htmx – high power tools for HTML

#123
post #94

One of the problems I see is that now anyone that was using intercooler is using an outdated and quite likely to become unmaintained library and be forced to migrate/rewrite things.

Would have had the same problem if the rewrite was called 2.0 instead of htmx. Hmmm, reminds me of the Angular 1 vs 2+ conumdrum (for which many said renaming would've been better).

Re: Htmx – high power tools for HTML

#124
post #77

The example on the front page already hints at the type of bad programming this may encourage. When clicked, the button sends a POST (this seems ok), and then the backend sends new html for the button. The idea of having random snippets of your frontend markup being returned from api servers seems questionable.

I don't think the idea of sending 'random' snippets of HTML to a browser and injecting them in to the DOM is inherently bad, and loads of frameworks have done exactly that in the past, but I would say that it does mean you have to be extremely good at managing your CSS. If something can be dropped in to the DOM anywhere where there's an hx attribute that could make managing the cascade specificity pretty tricky.

Re: Htmx – high power tools for HTML

#126
post #69

This looks amazing -- seems like you can accomplish a significant amount of what constitutes front-end work these days with htmx. The examples are compelling: https://htmx.org/examples/ There is a slight deal-breaker for me. Much of the functionality revolves around hx-swap'ing i.e. writing the contents of a response as HTML into/around tags. This requires the server-side to return HTML instead of JSON. From the docs…

You could check out the client side templates extension: https://htmx.org/extensions/client-side-templates/

FYI you seem to have misspelled template on that page:

  can use one of three attributes named -temlpate (e.g. mustache-template)

Re: Htmx – high power tools for HTML

#127
post #121

Earlier quoted context omitted.

tailwind is 1.7MB of CSS? ....whyy?

It defines css classes for most css properties. Their website [1] explains why you might want that pretty well. Regarding file size, the idea is that you use something like PurgeCSS in your build pipeline, which removes all unused css classes. A bit like tree shaking for css. [1] https://tailwind.css

https://tailwindcss.com is the link :D

Re: Htmx – high power tools for HTML

#128

hello, I'm the creator of htmx (and originally intercooler) I just released 0.0.4, so htmx is still very young, but it's got a decent test suite: https://htmx.org/test/0.0.4/test/ there is a nice extension mechanism: https://htmx.org/extensions/ and some very rough docs on how to pull off pure HTML animations: https://htmx.org/examples/animations/ happy to answer questions

On the click-to-load example https://htmx.org/examples/click-to-load/ I see no network traffic when I click the 'load more agents' button. Am I missing something, where are the requests going?

There is a "Server Requests" slide-up at the bottom of the page. If you expand it it has a nice interface to show requests and responses that are "happening" behind the scenes.

Re: Htmx – high power tools for HTML

#129
I like the theory of this (that is: using XHR to update parts of a page with the result of requests)

I'm immediately turned off by the demo though, because it's relying on a 'fake http server' in the client side JS.

If your toy examples can't be run against a real server, I have zero expectation of it working well for non-trivial examples.

Re: Htmx – high power tools for HTML

#130

I like the theory of this (that is: using XHR to update parts of a page with the result of requests) I'm immediately turned off by the demo though, because it's relying on a 'fake http server' in the client side JS. If your toy examples can't be run against a real server, I have zero expectation of it working well for non-trivial examples.

"Can't be run against a real server" sounds like a straw man you just made up? I'm astonished about how much you believe you can ascertain based on this... It's a demo, mocking a server is completely fine and also allow them to show it working without relying on other things.

I mean, this is actually even better. You can expand the mock-server down below and see what's happening.

Post reply on HN