Merge pull request 'add theme system' (#1) from develop into main
Reviewed-on: #1
This commit is contained in:
commit
2f35c6e792
2 changed files with 15 additions and 0 deletions
5
main.go
5
main.go
|
@ -6,6 +6,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"embed"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
@ -18,6 +19,9 @@ import (
|
||||||
"github.com/julienschmidt/httprouter"
|
"github.com/julienschmidt/httprouter"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed all:templates
|
||||||
|
var resources embed.FS
|
||||||
|
|
||||||
// The main function
|
// The main function
|
||||||
func main() {
|
func main() {
|
||||||
app := core.New()
|
app := core.New()
|
||||||
|
@ -43,6 +47,7 @@ func main() {
|
||||||
app.SetGormConfig(config.GetGormConfig())
|
app.SetGormConfig(config.GetGormConfig())
|
||||||
app.SetCacheConfig(config.GetCacheConfig())
|
app.SetCacheConfig(config.GetCacheConfig())
|
||||||
app.Bootstrap()
|
app.Bootstrap()
|
||||||
|
app.RegisterTemplates(resources)
|
||||||
registerGlobalHooks()
|
registerGlobalHooks()
|
||||||
registerRoutes()
|
registerRoutes()
|
||||||
registerEvents()
|
registerEvents()
|
||||||
|
|
10
templates/sample.html
Normal file
10
templates/sample.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
{{template "head" "Sample"}}
|
||||||
|
<body>
|
||||||
|
{{template "title" .TheTitle}}
|
||||||
|
<div class="section">
|
||||||
|
Sample page!
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in a new issue