jawsboot

package
v0.112.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 7 Imported by: 3

README

jawsboot

Provides a statically served and embedded version of Bootstrap.

Example usage that loads your templates, favicon and Bootstrap. Also uses a templatereloader so that when running with -tags debug or -race templates are reloaded from disk as needed.

//go:embed assets
var assetsFS embed.FS

func setupRoutes(jw *jaws.Jaws, mux *http.ServeMux) (faviconuri string, err error) {
	var tmpl jaws.TemplateLookuper
	if tmpl, err = templatereloader.New(assetsFS, "assets/ui/*.html", ""); err == nil {
		jw.AddTemplateLookuper(tmpl)
		if uris, err = staticserve.HandleFS(assetsFS, mux.Handle, "assets", "static/images/favicon.png"); err == nil {
			if err = jawsboot.Setup(jw, mux.Handle, uris...); err == nil {
				mux.Handle("/jaws/", jw) // ensure the JaWS routes are handled
				// set up your other routes
			}
		}
	}
	return
}

The example expects an assets directory in the source tree:

assets
├── static
│   └── images
│       └── favicon.png
└── ui
    ├── somepage.html
    ├── otherpage.html
    └── index.html

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(jw *jaws.Jaws, handleFn jaws.HandleFunc, prefix string) (urls []*url.URL, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL