/golang-htmx-live-reload

This project provides scaffolding for a Go based website with live reloading to speed up development.

Primary LanguageGoApache License 2.0Apache-2.0

golang-htmx-live-reload

This is project provides scaffolding for a Go based web site with live reloading to speed up development.

Features

This project includes the following:

  • Flat package structure for easy development.
  • Live reloading using my fork of reflex which has websockets support.
  • Templating using html/template.
  • echo-views package for rendering views.
  • echo-middleware I built which provides a set of useful middleware for logging and caching.
  • Error pages located in public which are rendered based on error code, these can be modified in public.
  • When DEV_MODE is enabled all assets are live reloaded from the filesystem making updates to templates and assets fast and simple.
  • When DEV_MODE is disabled all the assets are built into the binary ,which makes shipping the application to production simple.
  • Building of assets via esbuild is configured via reflex, this provides fast and efficient bundling of javascript.
  • Releases using goreleaser which builds the application for multiple platforms.
  • TailwindCSS for styling.

Usage

To get started just run make and open the site and start editing the templates in the views folder.

After retrieving dependencies you should see the following output.

Watching for changes...
go run github.com/wolfeidau/reflex -c reflex.conf
[02] Starting service
[02] <nil> DBG logger.go:26 > register template includes= layout=layouts/base.html name=pages/index.html
[02] <nil> INF main.go:31 > Serving on http://localhost:3333

References

License

This application is released under Apache 2.0 license and is copyright Mark Wolfe.