mirror of
https://git.mills.io/prologic/zs
synced 2024-11-24 22:36:10 +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
|
return nil, "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
b, err := ioutil.ReadFile(path)
|
b, err := os.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, "", fmt.Errorf("error getting vars from %q: %w", path, err)
|
||||||
}
|
}
|
||||||
s := string(b)
|
s := string(b)
|
||||||
|
|
||||||
@ -608,7 +608,7 @@ func buildAll(ctx context.Context, watch bool) error {
|
|||||||
return ctx.Err()
|
return ctx.Err()
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
os.Mkdir(PUBDIR, 0755)
|
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
|
// 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 || filepath.Dir(path) == ZSDIR) && info.ModTime().After(lastModified) {
|
||||||
if filepath.Base(path) == ZSIGNORE {
|
if filepath.Base(path) == ZSIGNORE {
|
||||||
@ -658,7 +658,7 @@ func buildAll(ctx context.Context, watch bool) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !watch {
|
if !watch {
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
lastModified = time.Now()
|
lastModified = time.Now()
|
||||||
}
|
}
|
||||||
|
4
testdata/simple/.zs/layout.html
vendored
4
testdata/simple/.zs/layout.html
vendored
@ -1,3 +1 @@
|
|||||||
<html>
|
{{ content }}
|
||||||
<body>{{ content }}</body>
|
|
||||||
</html>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user