Documentation ¶
Overview ¶
Create easily a http Handler for static file.
Index ¶
- Variables
- func Css(b []byte, f string) http.HandlerFunc
- func CssMinify(in []byte) []byte
- func File(b []byte, f string, mime string, min Minifier) http.HandlerFunc
- func Html(b []byte, f string) http.HandlerFunc
- func HtmlMinify(in []byte) []byte
- func Jpeg(b []byte, f string) http.HandlerFunc
- func Js(b []byte, f string) http.HandlerFunc
- func JsMinify(in []byte) []byte
- func Png(b []byte, f string) http.HandlerFunc
- func Svg(b []byte, f string) http.HandlerFunc
- func SvgMinify(in []byte) []byte
- func Template(b []byte, f string, min Minifier) *templatetext.Template
- func TemplateHTML(b []byte, f string) *templatehtml.Template
- func WebP(b []byte, f string) http.HandlerFunc
- type Minifier
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Dev disable the minifing and read all SleepDev the files. Dev bool = false // The duration of sleeping in development mode SleepDev time.Duration = 100 * time.Millisecond )
Functions ¶
func Css ¶
func Css(b []byte, f string) http.HandlerFunc
A binding of File for Css file.
http.HandleFunc("/style.css", static.Css(nil, "front/style/"))
func File ¶
Server a static content with a min Content-Type header.
The content is by default d. If f is non empty, the function read recurrent from f serve it. The reading error are silent.
The served content are minify (expect if Dev is enable) with min. If min is nil, the content are not minify.
func Html ¶
func Html(b []byte, f string) http.HandlerFunc
A binding of File for Html file.
http.HandleFunc("/", static.Html(nil, "front/index.html"))
func HtmlMinify ¶
func Js ¶
func Js(b []byte, f string) http.HandlerFunc
A binding of File for Js file.
http.HandleFunc("/app.js", static.Js(nil, "front/app.js"))
func Svg ¶
func Svg(b []byte, f string) http.HandlerFunc
A binding of File for SVG image.
http.HandleFunc("/icon.svg", static.Svg(nil, "front/icon.svg"))
func Template ¶
func Template(b []byte, f string, min Minifier) *templatetext.Template
Create template from b or the file f.
func TemplateHTML ¶
func TemplateHTML(b []byte, f string) *templatehtml.Template
Create template from b or the file f.
Types ¶
Click to show internal directories.
Click to hide internal directories.