embedx

package
v0.0.0-...-d72dd33 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FS

func FS(fsys fs.FS) http.FileSystem

FS converts fsys to a [FileSystem] implementation, for use with [FileServer] and [NewFileTransport]. The files provided by fsys must implement io.Seeker. This custom FS implement solves the caching problem when serving embedded files. The idea comes from https://www.reddit.com/r/golang/comments/118pqb2/comment/j9io84v/

Types

type Template

type Template struct {
	*template.Template
}

Template is convenient wrapper of html template

func (Template) ParseFS

func (t Template) ParseFS(fsys fs.FS) (*template.Template, error)

ParseFS is different from go's standard implement that it can recursively find all template files ending with `.tmpl` and load them with a template name of their path.

Jump to

Keyboard shortcuts

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