Skip to content

Commit

Permalink
register book public dir as build output
Browse files Browse the repository at this point in the history
  • Loading branch information
emad-elsaid committed Sep 23, 2024
1 parent 31c246e commit 743ca77
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions extensions/book/book.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package book
import (
"embed"
"html/template"
"io/fs"
"strings"

"github.com/emad-elsaid/xlog"
Expand Down Expand Up @@ -30,9 +31,26 @@ func init() {
})
xlog.RegisterTemplate(templates, "templates")
xlog.RegisterStaticDir(public)
registerBuildFiles()
xlog.RegisterWidget(xlog.HEAD_WIDGET, 0, style)
}

func registerBuildFiles() {
fs.WalkDir(public, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}

if d.IsDir() {
return nil
}

xlog.RegisterBuildPage("/"+path, false)

return nil
})
}

func style(xlog.Page) template.HTML {
return `<link rel="stylesheet" href="/public/book_style.css">`
}
Expand Down

0 comments on commit 743ca77

Please sign in to comment.