From: Anthony Talarico Date: Tue, 12 Jun 2018 20:18:12 +0000 (-0400) Subject: adding references for sass and functions file lines X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=59e0a950afbfe330849f6e3bc2bbfc208c21ccfb;p=WP-Themes%2FglmOrigin.git adding references for sass and functions file lines --- diff --git a/setup/renderer.js b/setup/renderer.js index 259bfa7..0da56e9 100644 --- a/setup/renderer.js +++ b/setup/renderer.js @@ -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)); });