[WIP] prep for embedded files 2
This commit is contained in:
parent
5c7bfc21ed
commit
98c98d16b4
7
main.go
7
main.go
@ -1,7 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"embed"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
@ -10,7 +9,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.hbanafa.com/hesham/viddl/resources"
|
"gitea.hbanafa.com/hesham/viddl/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -80,12 +79,12 @@ func writeJSONResponse(w http.ResponseWriter, s string) http.ResponseWriter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var templates *template.Template
|
var views *template.Template
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
||||||
log.Println("[ init ] Starting...")
|
log.Println("[ init ] Starting...")
|
||||||
templates = template.Must(template.ParseFS(resources.TemplatesFS, "templates/*.html"))
|
views = template.Must(template.ParseFS(templates.TemplatesFS , "*.html"))
|
||||||
|
|
||||||
}
|
}
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
package resources
|
|
||||||
|
|
||||||
import "embed"
|
|
||||||
|
|
||||||
//go:embed gitea.hbanafa.com/hesham/viddl/resources
|
|
||||||
var TemplatesFS embed.FS
|
|
||||||
|
|
7
templates/templates.go
Normal file
7
templates/templates.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package templates
|
||||||
|
|
||||||
|
import "embed"
|
||||||
|
|
||||||
|
//go:embed *.html
|
||||||
|
var TemplatesFS embed.FS
|
||||||
|
|
Loading…
Reference in New Issue
Block a user