reload themefs after change theme in config
This commit is contained in:
parent
a4cbd26044
commit
0347de57d9
1 changed files with 2 additions and 1 deletions
|
@ -21,6 +21,7 @@ var websiteData = struct {
|
|||
Contents []modules.GroupData
|
||||
}{}
|
||||
var webTemplate *template.Template
|
||||
var themefs http.Handler
|
||||
|
||||
func main() {
|
||||
prepare()
|
||||
|
@ -33,7 +34,6 @@ func main() {
|
|||
languagefs := http.FileServer(http.Dir(filepath.Join(pwd, "languages")))
|
||||
http.Handle("/languages/", http.StripPrefix("/languages/", languagefs))
|
||||
|
||||
themefs := http.FileServer(http.Dir(filepath.Join(pwd, "themes", appConfig.Website.Theme)))
|
||||
http.Handle("/theme/", http.StripPrefix("/theme/", themefs))
|
||||
|
||||
http.HandleFunc("/weather", serveWeather)
|
||||
|
@ -63,6 +63,7 @@ func loadData() {
|
|||
websiteData.Language = modules.LoadLanguage(appConfig.Website.Language)
|
||||
websiteData.Contents = modules.LoadContent().Data
|
||||
|
||||
themefs = http.FileServer(http.Dir(filepath.Join(pwd, "themes", appConfig.Website.Theme)))
|
||||
tmpl, _ := template.ParseFiles(filepath.Join(pwd, "themes", appConfig.Website.Theme, "index.html"))
|
||||
webTemplate = tmpl
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue