Fix bugs with referencing non-existent layouts

This commit is contained in:
James Mills 2024-08-24 16:17:22 +10:00
parent d7c5c48621
commit f69d56187b
No known key found for this signature in database
GPG Key ID: AC4C014F1440EBD6
2 changed files with 5 additions and 7 deletions

View File

@ -396,9 +396,9 @@ func getVars(path string, globals Vars) (Vars, string, error) {
return nil, "", nil
}
b, err := ioutil.ReadFile(path)
b, err := os.ReadFile(path)
if err != nil {
return nil, "", err
return nil, "", fmt.Errorf("error getting vars from %q: %w", path, err)
}
s := string(b)
@ -608,7 +608,7 @@ func buildAll(ctx context.Context, watch bool) error {
return ctx.Err()
case <-ticker.C:
os.Mkdir(PUBDIR, 0755)
filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
// rebuild if changes to .zs/ or .zsignore
if (filepath.Base(path) == ZSIGNORE || filepath.Dir(path) == ZSDIR) && info.ModTime().After(lastModified) {
if filepath.Base(path) == ZSIGNORE {
@ -658,7 +658,7 @@ func buildAll(ctx context.Context, watch bool) error {
}
}
if !watch {
return nil
return err
}
lastModified = time.Now()
}

View File

@ -1,3 +1 @@
<html>
<body>{{ content }}</body>
</html>
{{ content }}