embed html template and static files
This commit is contained in:
parent
b150fa491c
commit
e5dcc4b884
44 changed files with 316 additions and 255 deletions
|
@ -1,28 +1,36 @@
|
|||
package templates
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"path/filepath"
|
||||
_ "embed"
|
||||
"html/template"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var IndexTemplate = template.Must(template.ParseFiles(
|
||||
filepath.Join("views", "layout.html"),
|
||||
filepath.Join("views", "header.html"),
|
||||
filepath.Join("views", "footer.html"),
|
||||
filepath.Join("views", "prideflag.html"),
|
||||
filepath.Join("views", "index.html"),
|
||||
))
|
||||
var MusicTemplate = template.Must(template.ParseFiles(
|
||||
filepath.Join("views", "layout.html"),
|
||||
filepath.Join("views", "header.html"),
|
||||
filepath.Join("views", "footer.html"),
|
||||
filepath.Join("views", "prideflag.html"),
|
||||
filepath.Join("views", "music.html"),
|
||||
))
|
||||
var MusicGatewayTemplate = template.Must(template.ParseFiles(
|
||||
filepath.Join("views", "layout.html"),
|
||||
filepath.Join("views", "header.html"),
|
||||
filepath.Join("views", "footer.html"),
|
||||
filepath.Join("views", "prideflag.html"),
|
||||
filepath.Join("views", "music-gateway.html"),
|
||||
//go:embed "html/layout.html"
|
||||
var layoutHTML string
|
||||
//go:embed "html/header.html"
|
||||
var headerHTML string
|
||||
//go:embed "html/footer.html"
|
||||
var footerHTML string
|
||||
//go:embed "html/prideflag.html"
|
||||
var prideflagHTML string
|
||||
//go:embed "html/index.html"
|
||||
var indexHTML string
|
||||
//go:embed "html/music.html"
|
||||
var musicHTML string
|
||||
//go:embed "html/music-gateway.html"
|
||||
var musicGatewayHTML string
|
||||
// //go:embed "html/404.html"
|
||||
// var error404HTML string
|
||||
|
||||
var BaseTemplate = template.Must(template.New("base").Parse(
|
||||
strings.Join([]string{
|
||||
layoutHTML,
|
||||
headerHTML,
|
||||
footerHTML,
|
||||
prideflagHTML,
|
||||
}, "\n"),
|
||||
))
|
||||
var IndexTemplate = template.Must(template.Must(BaseTemplate.Clone()).Parse(indexHTML))
|
||||
var MusicTemplate = template.Must(template.Must(BaseTemplate.Clone()).Parse(musicHTML))
|
||||
var MusicGatewayTemplate = template.Must(template.Must(BaseTemplate.Clone()).Parse(musicGatewayHTML))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue