path,
async result => {
console.log('compiling', path)
- result.value = await js_template(path, '_env,_out,_get')
+ result.value = await js_template(path)
}
)
temp = page + '.jst'
try {
let buffers = []
- let env = {
+ let _env = {
cookies: cookie.parse(req.headers.cookie || ''),
lang: 'en',
method: req.method,
site: site,
site_root: site_root
}
- let out = text => {buffers.push(Buffer.from(text))}
- let get = async (path, type) => {
+ let _out = text => {buffers.push(Buffer.from(text))}
+ let _req = async (path, type) => {
path = (
path.length > 0 && path.charAt(0) === '/' ?
site_root :
) + path
switch (type) {
case undefined:
- return /*await*/ (await resources.get_jst(path))(env, out, get)
+ return /*await*/ (await resources.get_jst(path))(_env, _out, _req)
case 'email':
return /*await*/ resources.get_email(path)
case 'jst':
}
assert(false)
}
- await get(temp)
+ await _req(temp)
let data = Buffer.concat(buffers)
console.log(
site,