Slight rationalization to how relative or absolute path is passed into Server
authorNick Downing <nick@ndcode.org>
Tue, 30 Oct 2018 05:09:03 +0000 (16:09 +1100)
committerNick Downing <nick@ndcode.org>
Tue, 30 Oct 2018 05:09:03 +0000 (16:09 +1100)
Server.js
SiteRoot.js

index 7e4ad5b..54ec6e7 100644 (file)
--- a/Server.js
+++ b/Server.js
@@ -38,7 +38,7 @@ let Server = function() {
 }
 
 Server.prototype.get_email = function(pathname) {
-  return this.build_cache_email.get(
+  return /*await*/ this.build_cache_email.get(
     pathname,
     async result => {
       let text = await fs_readFile(pathname, {encoding: 'utf-8'})
@@ -51,7 +51,7 @@ Server.prototype.get_email = function(pathname) {
 // this is for read-only JSON files
 // they will be reloaded from disk if modified
 Server.prototype.get_json = function(pathname) {
-  return this.build_cache_json.get(
+  return /*await*/ this.build_cache_json.get(
     pathname,
     async result => {
       let text = await fs_readFile(pathname, {encoding: 'utf-8'})
@@ -62,11 +62,12 @@ Server.prototype.get_json = function(pathname) {
 }
 
 Server.prototype.get_jst = function(dirname, pathname) {
-  return js_template(dirname, dirname, pathname, {_server: this})
+  return /*await*/ js_template(dirname, dirname, pathname, {_server: this})
 }
 
 Server.prototype.get_less = function(dirname, pathname) {
-  return this.build_cache_less.get(
+  pathname = dirname + pathname
+  return /*await*/ this.build_cache_less.get(
     pathname,
     async result => {
       let text = await fs_readFile(pathname, {encoding: 'utf-8'})
@@ -85,7 +86,7 @@ Server.prototype.get_less = function(dirname, pathname) {
           //lint: false,
           //math: 0,
           //modifyVars: null,
-          pathnames: [this.root + dirname],
+          pathnames: [dirname],
           //plugins: [],
           //reUsePluginManager: true,
           //rewriteUrls: false,
@@ -102,7 +103,7 @@ Server.prototype.get_less = function(dirname, pathname) {
 }
 
 Server.prototype.get_text = function(pathname) {
-  return this.build_cache_text.get(
+  return /*await*/ this.build_cache_text.get(
     pathname,
     async result => {
       let text = await fs_readFile(pathname, {encoding: 'utf-8'})
@@ -113,7 +114,7 @@ Server.prototype.get_text = function(pathname) {
 }
 
 Server.prototype.get_zet = function(pathname) {
-  return this.build_cache_zet.get(
+  return /*await*/ this.build_cache_zet.get(
     pathname,
     async result => {
       console.log('getting', pathname, 'as zet')
@@ -129,7 +130,7 @@ Server.prototype.get_zet = function(pathname) {
 }
 
 Server.prototype.get_zip = function(pathname) {
-  return this.build_cache_zip.get(
+  return /*await*/ this.build_cache_zip.get(
     pathname,
     async result => {
       let zipfile = await yauzl_open(pathname, {autoClose: false})
index b7a8f0b..a3d981b 100644 (file)
@@ -23,10 +23,10 @@ SiteRoot.prototype.get_json = function(pathname) {
   return /*await*/ this.server.get_json(this.root + pathname)
 }
 SiteRoot.prototype.get_jst = function(pathname) {
-  return /*await*/ this.server.get_jst(this.root, /*this.root +*/ pathname)
+  return /*await*/ this.server.get_jst(this.root, pathname)
 }
 SiteRoot.prototype.get_less = function(pathname) {
-  return /*await*/ this.server.get_less(this.root, this.root + pathname)
+  return /*await*/ this.server.get_less(this.root, pathname)
 }
 SiteRoot.prototype.get_text = function(pathname) {
   return /*await*/ this.server.get_text(this.root + pathname)