Skip to content

gopk/templates

Repository files navigation

Templates GO wrapper

Build Status Go Report Card GoDoc Coverage Status

MIT License

Project represents simple wrapper of standart GO templates to make it simpler.

Example

import (
  temp "github.com/gopk/templates/v2"
)

func main() {
  render := temp.NewHTMLFS(fs.Context, "", ".html", isNotDebug())

  mux := http.NewServeMux()
  mux.HandleFunc("/", render.HTTPHandler(func(w http.ResponseWriter, r *http.Request) *temp.HTTPResponse {
    return temp.Response(http.StatusOK, "index", params)
  })
}