Don't generate the layout inside the layout and do a build before watch. BUG: This suddenly crashes now when watching, which sucks.

master
Zed A. Shaw 6 days ago
parent b0047ab2ce
commit 6eacdff12e
  1. 8
      main.go

@ -130,10 +130,14 @@ func RePrefixPath(path string, new_prefix string) string {
return filepath.Join(prefixed_path...) return filepath.Join(prefixed_path...)
} }
func SamePath(a string, b string) bool {
return filepath.ToSlash(a) == filepath.ToSlash(b)
}
func ProcessDirEntry(path string, d fs.DirEntry, err error) error { func ProcessDirEntry(path string, d fs.DirEntry, err error) error {
settings := config.Settings settings := config.Settings
if !d.IsDir() { if !d.IsDir() && !SamePath(path, config.Settings.Layout) {
if err != nil { return Fail(err, "path: %s", path); } if err != nil { return Fail(err, "path: %s", path); }
source_name, ext, found := SplitPathExt(path) source_name, ext, found := SplitPathExt(path)
@ -289,6 +293,8 @@ func main() {
switch command { switch command {
case "watch": case "watch":
config.Load(config_file) config.Load(config_file)
SyncStaticDir();
RenderPages();
WatchDir() WatchDir()
case "init": case "init":
InitConfig(config_file) InitConfig(config_file)

Loading…
Cancel
Save