Matthew Stobbs
2419d5d3a6
- added air to reload the server on changes automatically - added tailwindcss - added base page structure in html using _index, _header and _footer - added static homepage - added style.css built by tailwindcss - added basic View object to control views and templates
44 lines
909 B
Go
44 lines
909 B
Go
package view
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
// Regular pages are defined as views here, like the homepage
|
|
|
|
// Major components of each page.
|
|
const (
|
|
index = `view/_index.gohtml`
|
|
header = `view/_header.gohtml`
|
|
footer = `view/_footer.gohtml`
|
|
)
|
|
|
|
// These constitute the static parts of the site that don't need to change, loaded as a template for rendering
|
|
const (
|
|
home = `view/static/home.gohtml`
|
|
)
|
|
|
|
func init() {
|
|
if fi, err := os.Stat(index); err != nil {
|
|
log.Fatal(fi.Name(), fi.IsDir(), err)
|
|
}
|
|
if fi, err := os.Stat(header); err != nil {
|
|
log.Fatal(fi.Name(), fi.IsDir(), err)
|
|
}
|
|
if fi, err := os.Stat(footer); err != nil {
|
|
log.Fatal(fi.Name(), fi.IsDir(), err)
|
|
}
|
|
if fi, err := os.Stat(home); err != nil {
|
|
log.Fatal(fi.Name(), fi.IsDir(), err)
|
|
}}
|
|
|
|
var ViewHome *View
|
|
|
|
func init() {
|
|
log.Println("Initializing homepage")
|
|
var err error
|
|
ViewHome, err = NewFromFile(home)
|
|
log.Println(err)
|
|
}
|