@import "foundation";
@import "core/header/header";
@import "core/topbar/topbar";
-@import "core/interior-page/interior-page";
+// @import "core/interior-page/interior-page";
@import "core/front-page/front-page";
-@import "core/blog/blog";
+// @import "core/blog/blog";
@import "core/off-canvas/off-canvas";
@import "core/off-canvas-overlay/off-canvas-overlay";
@import "core/footer/footer";
/*Custom Modules */
@import "custom/sidebar/sidebar";
@import "custom/slideshow/slideshow";
-@import "custom/gravity-forms/gravity-forms";
+// @import "custom/gravity-forms/gravity-forms";
@import "custom/weather/weather";
@import "custom/nextgen/nextgen";
@import "custom/glma/glm-member-db";
-@import "custom/glma/glm-member-db-events";
+// @import "custom/glma/glm-member-db-events";
@import "custom/blocks/glm-blocks";
@import "custom/action-items/action-items";
@import "custom/svg-map/svg-map";
-@import "custom/woocommerce/woocommerce";
\ No newline at end of file
+// // // @import "custom/woocommerce/woocommerce";
\ No newline at end of file
require_once('core/topbar/functions/topbar.php');
require_once('core/footer/functions/footer.php');
require_once('core/front-page/functions/front-page.php');
-require_once('core/interior-page/functions/interior-page.php');
+// require_once('core/interior-page/functions/interior-page.php');
require_once('core/off-canvas/functions/off-canvas.php');
require_once('core/off-canvas-overlay/functions/off-canvas-overlay.php');
-require_once('core/blog/functions/blog.php');
+// require_once('core/blog/functions/blog.php');
/* Custom Modules */
-require_once('custom/gravity-forms/functions/gravity-forms.php');
-require_once('custom/woocommerce/functions/woocommerce.php');
+// require_once('custom/gravity-forms/functions/gravity-forms.php');
+// // // require_once('custom/woocommerce/functions/woocommerce.php');
require_once('custom/svg-map-forms/functions/svg-map.php');
require_once('custom/sidebar/functions/sidebar.php');
require_once('custom/nextgen/functions/nextgen.php');
+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) + length);
+ }else {
+ if(position === 'before'){
+ return this.substr(0, this.indexOf(token))
+ }else{
+ return this.substr(this.indexOf(token)+length)
+ }
+ }
+}
+String.prototype.stripSlashes = function(){
+ return this.replace(/\\(.)/mg, "$1");
+}
const modLib = (function() {
let appState = {};
let fs = require('fs');
input: fs.createReadStream(filePath)
});
},
+
checkLine: function(line, mod){
- if ( modLib.moduleFound(line, mod)){
- console.log(line)
+ if ( modLib.moduleFound(line, mod) && modLib.isValidLine(line, mod)){
+ return true
+ } else {
+ return false;
}
},
+
editFile: function(reader,mod){
reader.on("line",function(line){
- modLib.checkLine(line, mod)
+ let file = (this.input.path.indexOf("scss") > -1) ? 'sass' : 'php';
+ if(modLib.checkLine(line, mod)){
+ modLib.deactivateModule(line, mod, file)
+ }
})
},
+
moduleFound(line,mod){
if(modLib.isValidLine(line, mod) ){
if(line.indexOf(`${mod.name}"`) > -1 || line.indexOf(`${mod.name}.php`) > -1){
}
}
},
- deactivateModule(mod, line){
-
+
+ deactivateModule(line, mod, file){
+ let pathString = (file === "sass") ? mod.sass.sassFile : mod.functions.functionsFile;
+ if(!mod.active){
+
+ // conver to function
+ fs.readFile(pathString, 'utf8', function (err,data) {
+ if (err) {
+ return console.log(err);
+ }
+ result = data.replace(line, `// ${line}`);
+
+ fs.writeFile(pathString, result, 'utf8', function (err) {
+ if (err) return console.log(err);
+ });
+ });
+ } else{
+ console.log("active")
+ fs.readFile(pathString, 'utf8', function (err,data) {
+ if (err) {
+ return console.log(err);
+ }
+ console.log(data);
+ result = data.replace(line, line.stripSlashes());
+
+ fs.writeFile(pathString, result, 'utf8', function (err) {
+ if (err) return console.log(err);
+ });
+ });
+ }
},
+
isValidLine(line){
let valid = false;
for (var i = 0; i < acceptedToken.length; i++) {
}
return valid;
},
+
setModules: function(modType,modName){
appState[modType] = modName;
return appState;
},
+
moduleActive(mod){
return mod.active;
},
+
storeModules: function(appState){
localStorage.setItem("app", JSON.stringify(appState));
},
scanDevDir: function(){
var slash = modLib.getDirSlash();
+ let devPath = require('path').join(__dirname, `../dev`);
if(modLib.getModules() === null){
[`dev${slash}core`, `dev${slash}custom`].forEach(function(dirPath) {
let modType = dirPath.stringFromToken('after', `${slash}`);
let fullPath = require('path').join(__dirname, `../${dirPath}`);
+
let mods = [];
fs.readdir(fullPath, function(err, item) {
item.forEach(function(modName){
modType: modType,
active: true,
path: `${fullPath}${slash}${modName}`,
- sass: {lineRef:` ${reference}${slash}${modName}`, sassFile: `dev${slash}app${slash}scss`},
- functions: {lineRef: `${reference}${slash}functions${slash}${modName}.php`, functionsfile: `dev${slash}modules.php`},
+ sass: {lineRef:` ${reference}${slash}${modName}`, sassFile: `${devPath}${slash}app.scss`},
+ functions: {lineRef: `${reference}${slash}functions${slash}${modName}.php`, functionsFile: `${devPath}${slash}modules.php`},
reference:reference
});
});
const dir = require('node-dir');
const lib = require('./moduleLib');
-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) + length);
- }else {
- if(position === 'before'){
- return this.substr(0, this.indexOf(token))
- }else{
- return this.substr(this.indexOf(token)+length)
- }
- }
-}
-String.prototype.stripSlashes = function(){
- return this.replace(/\\(.)/mg, "$1");
-}
$(document).on("click", '.module-item', function(){
_ = $(this);