Skip to content

Commit e4d58cc

Browse files
committed
fix: use path self for cwd-independent path resolution in templates example
1 parent 0e8e01e commit e4d58cc

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

examples/templates/serve.nu

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
const script_dir = path self | path dirname
2+
13
# Seed store topics from disk files when --store is enabled
24
if $HTTP_NU.store != null {
3-
open examples/templates/topics/page.html | .append page.html
4-
open examples/templates/topics/base.html | .append base.html
5-
open examples/templates/topics/nav.html | .append nav.html
5+
open ($script_dir | path join topics/page.html) | .append page.html
6+
open ($script_dir | path join topics/base.html) | .append base.html
7+
open ($script_dir | path join topics/nav.html) | .append nav.html
68
}
79
810
{|req|
911
match $req.path {
10-
"/file" => { {name: "World"} | .mj "examples/templates/page.html" }
12+
"/file" => { {name: "World"} | .mj ($script_dir | path join page.html) }
1113
"/topic" => { {name: "World"} | .mj --topic "page.html" }
1214
_ => {
1315
{} | .mj --inline '<h1>Templates</h1>

0 commit comments

Comments
 (0)