All Projects → arschles → go-bindata-html-template

arschles / go-bindata-html-template

Licence: Apache-2.0 license
Serve HTML templates from go-bindata

Programming Languages

go
31211 projects - #10 most used programming language

go-bindata-html-template

GoDoc

go-bindata-html-template is a wrapper for Go's built in html/template package to work with template contents embedded with the go-bindata tool instead of contents on the filesystem See https://github.com/jteeuwen/go-bindata for more information about embedding binary data with go-bindata.

It's compatible with a subset of the functionality in html/template.

Example usage (after running go-bindata data/... in your project directory):

import (
  "github.com/arschles/go-bindata-html-template"
)

//...

func myHandler(res http.ResponseWriter, req *http.Request) {
  tmpl, err := template.New("mytmpl", Asset).Parse("data/templates/my.tmpl")
  if err != nil {
    log.Fatalf("error parsing template: %s", err)
  }
  err := tmpl.Execute(res)
  if err != nil {
    log.Fatalf("error executing template: %s", err)
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].