Hacker News new | ask | show | jobs
by ionrock 745 days ago
After dealing with the current state of affairs regarding the front end, I think this is pretty interesting. I've been writing Go web apps with templ and htmx. I've punted on dealing with CSS using a cdn and bulma. I did get Tailwind and friends working, but it required a lot of work being outside a React/JS framework like next.js. It also felt really weird using npm to install CSS.

The nice thing about this is that you can get a tailwind Go lib to programmatically build into your binary. There are no extra files, one build step, and one binary output. After trying out Fly and Vercel, I went to running things with docker on a VM, and a single binary in a container makes things much simpler IMO.

This looks pretty cool and I look forward to seeing folks do interesting things with it.

2 comments

I do this too. Using a hot reload server and having live reload in the browser as I'm changing tailwind classes, go files or templ files is a very efficient workflow.

Then for the actual build, everything is built and embedded in a single binary by conditionally using embed with build tags.

I think that live feedback development cycle is probably the most satisfying way to code something by oneself.

It did need quite a bit of messing around with tooling and my Makefiles are pretty big but at least I can reuse that in every new project.

Could you go into more details about the live reload (I use air + Echo), what hot reload server do you use for templ?

And what about "embed with build tags."? I embed every build now.

I use the "live reload with other tools" as it is described in the templ docs [0].

Basically, templ will start a live reload server in "proxy mode". Other tools can then request a reload by notifying the proxy. I started with the makefile described in the docs. But I also have tailwind in watch mode, esbuild builds and more.

[0]: https://templ.guide/commands-and-tools/live-reload-with-othe...

Same here, Go + HTMX + templ. And I'm also need npx for tailwind.

So I would like to try something like this too. Integration with templ for local CSS components would be nice.

Also agree to the single binary, wrote here https://www.inkmi.com/blog/simplicity-of-golang-systemd-depl... (with systemd instead of a container)