add a bunch of frontend stuff
This commit is contained in:
parent
2586161abd
commit
bc85b7c340
30 changed files with 1459 additions and 136 deletions
28
web/templates/templates.go
Normal file
28
web/templates/templates.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package templates
|
||||
|
||||
import (
|
||||
"embed"
|
||||
|
||||
"emperror.dev/errors"
|
||||
"github.com/flosch/pongo2/v6"
|
||||
)
|
||||
|
||||
//go:embed *
|
||||
var fs embed.FS
|
||||
|
||||
func New(dev bool) (*pongo2.TemplateSet, error) {
|
||||
if dev {
|
||||
loader, err := pongo2.NewLocalFileSystemLoader("web/templates")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "creating filesystem loader")
|
||||
}
|
||||
|
||||
ts := pongo2.NewSet("web", loader)
|
||||
ts.Debug = true
|
||||
return ts, nil
|
||||
}
|
||||
|
||||
loader := pongo2.NewFSLoader(fs)
|
||||
ts := pongo2.NewSet("web", loader)
|
||||
return ts, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue