Update to js_template.git commit d0345db
authorNick Downing <downing.nick@gmail.com>
Mon, 15 Oct 2018 00:03:23 +0000 (11:03 +1100)
committerNick Downing <downing.nick@gmail.com>
Mon, 15 Oct 2018 00:03:23 +0000 (11:03 +1100)
site.js

diff --git a/site.js b/site.js
index 22ed278..f2978e6 100644 (file)
--- a/site.js
+++ b/site.js
@@ -125,7 +125,6 @@ let app = async (site, site_root, req, res, protocol) => {
     case 'html':
       temp = page + '.jst'
       try {
-        let buffers = []
         let _env = {
           cookies: cookie.parse(req.headers.cookie || ''),
           lang: 'en',
@@ -150,7 +149,7 @@ let app = async (site, site_root, req, res, protocol) => {
           site: site,
           site_root: site_root
         }
-        let _out = text => {buffers.push(Buffer.from(text))}
+        let _out = []
         let _req = async path => /*await*/ resources.get_jst(
           (
             path.length > 0 && path.charAt(0) === '/' ?
@@ -158,8 +157,8 @@ let app = async (site, site_root, req, res, protocol) => {
             site_root + dir_name + '/'
           ) + path
         )
-        await _req(temp)
-        let data = Buffer.concat(buffers)
+        await (await _req(temp))(_env, _out, _req)
+        let data = Buffer.from(_out.join(''))
         console.log(
           site,
           'serving',