Make the root directory and current directory available as _root and _dirname
authorNick Downing <nick@ndcode.org>
Tue, 30 Oct 2018 01:13:10 +0000 (12:13 +1100)
committerNick Downing <nick@ndcode.org>
Tue, 30 Oct 2018 07:54:35 +0000 (18:54 +1100)
js_template.js

index 5dfcb1b..56b2e29 100644 (file)
@@ -24,10 +24,12 @@ let js_template = async (root, dirname, pathname, args) => {
     async result => {
       dirname = path.posix.dirname(pathname)
 
-      let arg_names = ['_require', '_html_escape']
+      let arg_names = ['_require', '_html_escape', '_root', '_dirname']
       let arg_values = [
         async pathname => js_template(root, dirname, pathname, args),
-        html_escape
+        html_escape,
+        root,
+        dirname
       ]
       if (args !== undefined)
         for (let i in args)