Improved initialization
This commit is contained in:
parent
68e1211159
commit
29fdd9d26e
13
App.go
13
App.go
@ -18,11 +18,16 @@ type App struct {
|
|||||||
posts map[string]*Post
|
posts map[string]*Post
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *App) Init() {
|
func New() *App {
|
||||||
app.html = loadClean("public/app.html")
|
html := loadClean("public/app.html")
|
||||||
css := loadClean("public/app.css")
|
css := loadClean("public/app.css")
|
||||||
app.html = strings.Replace(app.html, "{head}", fmt.Sprintf("{head}<style>%s</style>", css), 1)
|
html = strings.Replace(html, "{head}", fmt.Sprintf("{head}<style>%s</style>", css), 1)
|
||||||
app.posts = loadPosts("posts")
|
posts := loadPosts("posts")
|
||||||
|
|
||||||
|
return &App{
|
||||||
|
html: html,
|
||||||
|
posts: posts,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *App) Run() {
|
func (app *App) Run() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user