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
|
||||
}
|
||||
|
||||
func (app *App) Init() {
|
||||
app.html = loadClean("public/app.html")
|
||||
func New() *App {
|
||||
html := loadClean("public/app.html")
|
||||
css := loadClean("public/app.css")
|
||||
app.html = strings.Replace(app.html, "{head}", fmt.Sprintf("{head}<style>%s</style>", css), 1)
|
||||
app.posts = loadPosts("posts")
|
||||
html = strings.Replace(html, "{head}", fmt.Sprintf("{head}<style>%s</style>", css), 1)
|
||||
posts := loadPosts("posts")
|
||||
|
||||
return &App{
|
||||
html: html,
|
||||
posts: posts,
|
||||
}
|
||||
}
|
||||
|
||||
func (app *App) Run() {
|
||||
|
Loading…
Reference in New Issue
Block a user