mirror of
https://github.com/lucaspalomodevelop/JSSTE.git
synced 2026-03-12 23:17:22 +00:00
removing uncomment code
This commit is contained in:
parent
36225ac7e8
commit
da12e94818
@ -1,7 +1,6 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const jsonmerger = require("./jsonMerger");
|
||||
//let appdir = path.join(__dirname, "..");
|
||||
let app = {};
|
||||
|
||||
app.__config = require("./config");
|
||||
@ -25,9 +24,6 @@ app.CONST = function (pagecode, constant, callback) {
|
||||
};
|
||||
|
||||
app.render = function (pagecode, templatecode) {
|
||||
//let result = "";
|
||||
|
||||
//if (!pagecode == JSON) pagecode = JSON.parse(pagecode);
|
||||
app.setState({ status: 0, statusMSG: "Render Page" });
|
||||
if (
|
||||
(pagecode != null || pagecode != undefined) &&
|
||||
@ -41,7 +37,6 @@ app.render = function (pagecode, templatecode) {
|
||||
app.setState({ status: 1, statusMSG: "Pagecode is undefined" });
|
||||
}
|
||||
|
||||
//TODO
|
||||
if (!templatecode) {
|
||||
try {
|
||||
app.setState({ status: 0, statusMSG: "Load Templatecode" });
|
||||
@ -65,8 +60,6 @@ app.render = function (pagecode, templatecode) {
|
||||
let importPath = importName.startsWith(".")
|
||||
? path.join(_pagecode["_SELFPATH_"].toString(), importName.toString())
|
||||
: path.join(app.config.pagePath, importName);
|
||||
// console.log(importPath);
|
||||
// console.log(_pagecode);
|
||||
try {
|
||||
importCodeString = fs.readFileSync(importPath, "utf-8");
|
||||
} catch (error) {
|
||||
@ -84,8 +77,6 @@ app.render = function (pagecode, templatecode) {
|
||||
|
||||
recursive(imports);
|
||||
|
||||
//console.log(ImportSet);
|
||||
|
||||
let currentPagecode = _pagecode;
|
||||
|
||||
ImportSet.forEach(function (importPath) {
|
||||
@ -98,9 +89,8 @@ app.render = function (pagecode, templatecode) {
|
||||
pagecode = currentPagecode;
|
||||
};
|
||||
|
||||
//TODO Killed Root Import
|
||||
app.CONST(pagecode, "_IMPORTS_", DissolveImports);
|
||||
//console.log(pagecode);
|
||||
|
||||
app.CONST(pagecode, "_STYLES_", (pagecode, value) => {
|
||||
app.setState({ status: 0, statusMSG: "Import Styles" });
|
||||
let rex = /<head>(.|\n|\t|\r)*?<\/head>/;
|
||||
@ -111,9 +101,9 @@ app.render = function (pagecode, templatecode) {
|
||||
});
|
||||
|
||||
header += "\n</head>";
|
||||
// console.log(header);
|
||||
|
||||
templatecode = templatecode.replace(/<head>(.|\n|\t|\r)*?<\/head>/, header);
|
||||
// replaceAll(templatecode,rex,value)
|
||||
|
||||
});
|
||||
|
||||
app.setState({ status: 0, statusMSG: "Set vars" });
|
||||
|
||||
33
src/index.js
33
src/index.js
@ -28,43 +28,10 @@ app.setStateFunction = function (callback) {
|
||||
this.setState({ status: 0, statusMSG: "JSSTE is ready" });
|
||||
};
|
||||
|
||||
// app.log = function({status, statusMSG}){
|
||||
|
||||
// };
|
||||
// engine.config = app.config;
|
||||
app.__config = require("./config");
|
||||
app.config = app.__config.getConfig();
|
||||
engine.log = app.log;
|
||||
engine.setState = app.setState;
|
||||
|
||||
// app.expressEngine = (
|
||||
// config = {
|
||||
// templatePath: "templates",
|
||||
// pagePath: "pages",
|
||||
// }
|
||||
// ) => {
|
||||
// config = mergeJson.mergeJson(app.config, config);
|
||||
// let hasrendered = false;
|
||||
// return (filePath, options, callback) => {
|
||||
// if (!hasrendered) {
|
||||
// app.config.templatePath = path.join(
|
||||
// options.settings.views,
|
||||
// config.templatePath
|
||||
// );
|
||||
// app.config.pagePath = path.join(options.settings.views, config.pagePath);
|
||||
// hasrendered = true;
|
||||
// }
|
||||
// // define the template engine
|
||||
// fs.readFile(filePath, function (err, content) {
|
||||
// content = content.toString();
|
||||
// // content = mergeJson.mergeJson(JSON.parse(content), options);
|
||||
|
||||
// if (err) return callback(new Error(err));
|
||||
// // this is an extremely simple template engine
|
||||
// var rendered = app.render(content);
|
||||
// return callback(null, rendered);
|
||||
// });
|
||||
// };
|
||||
// };
|
||||
|
||||
module.exports = app;
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
function mergeJson(org, ext) {
|
||||
// let placeholder = undefined;
|
||||
|
||||
if (!(typeof org === 'object' && org !== null)) {
|
||||
org = JSON.parse(org);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user