adding references for sass and functions file lines
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 12 Jun 2018 20:18:12 +0000 (16:18 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 12 Jun 2018 20:18:12 +0000 (16:18 -0400)
setup/renderer.js

index 259bfa7..0da56e9 100644 (file)
@@ -11,16 +11,19 @@ var functionsFileReader = require('readline').createInterface({
 var lineReader = require('readline').createInterface({
     input: require('fs').createReadStream('dev/app.scss')
 });
-String.prototype.stringFromToken = function(position, token, lastToken = false){
+String.prototype.stringFromToken = function(position, token, lastToken = false, string = false){
+    let length = 1;
+    if(string) length = token.length;
+
     if(lastToken && position === 'before'){
         return this.substr(0, this.lastIndexOf(token))
     }else if(lastToken && !postition === 'before'){
-        return this.substr(this.lastIndexOf(token) + 1);
+        return this.substr(this.lastIndexOf(token) + length);
     }else {
         if(position === 'before'){
             return this.substr(0, this.indexOf(token))
         }else{
-            return this.substr(this.indexOf(token)+1)
+            return this.substr(this.indexOf(token)+length)
         }
     }
 }
@@ -82,7 +85,15 @@ function scanDev(){
         let mods = [];
         fs.readdir(fullPath, function(err, item) {
             item.forEach(function(modName){
-                mods.push({name: modName, active: true, path: `${fullPath}/${modName}`});
+                let reference = `${fullPath}/${modName}`.stringFromToken('after',"dev/", false, true);
+                mods.push({
+                    name: modName, 
+                    active: true, 
+                    path: `${fullPath}/${modName}`, 
+                    sass: `${reference}/${modName}`,
+                    functions: `${reference}/functions/${modName}.php`,
+                    reference:reference 
+                });
             });
             storeModules(setModules(modType,mods));    
         });