mirror of
https://git.mills.io/prologic/zs
synced 2024-11-24 14:26:11 +03:00
Fix bugs with referencing non-existent layouts
This commit is contained in:
parent
d7c5c48621
commit
f69d56187b
8
main.go
8
main.go
@ -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()
|
||||
}
|
||||
|
4
testdata/simple/.zs/layout.html
vendored
4
testdata/simple/.zs/layout.html
vendored
@ -1,3 +1 @@
|
||||
<html>
|
||||
<body>{{ content }}</body>
|
||||
</html>
|
||||
{{ content }}
|
||||
|
Loading…
Reference in New Issue
Block a user