mirror of
https://github.com/lucaspalomodevelop/JSSTE.git
synced 2026-03-12 23:17:22 +00:00
del dist and gulpfile
This commit is contained in:
parent
1d7b951a10
commit
bab47bfa1d
20
gulpfile.js
20
gulpfile.js
@ -1,20 +0,0 @@
|
||||
const gulp = require('gulp');
|
||||
const minify = require('gulp-minify');
|
||||
|
||||
gulp.task('build', function(done) {
|
||||
var Src = './src/*js',
|
||||
Dst = 'dist';
|
||||
gulp.src(Src)
|
||||
.pipe(minify({
|
||||
ext:{
|
||||
|
||||
min:'.js'
|
||||
},
|
||||
noSource: true,
|
||||
exclude: ['tasks'],
|
||||
ignoreFiles: ['.combo.js', '-min.js']
|
||||
}))
|
||||
.pipe(gulp.dest(Dst))
|
||||
done();
|
||||
|
||||
});
|
||||
10
package.json
10
package.json
@ -2,20 +2,19 @@
|
||||
"name": "jsste",
|
||||
"version": "1.1.1",
|
||||
"description": "A Javascript Static Template Emgine",
|
||||
"main": "dist/index.js",
|
||||
"main": "src/index.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"src",
|
||||
"package.json",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"build": "gulp build",
|
||||
"publish": "npm run build && npm publish --access publish"
|
||||
"publish": "npm publish --access publish"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -34,6 +33,9 @@
|
||||
"dependencies": {
|
||||
"jsdom": "^16.5.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"assert": "^2.0.0",
|
||||
"chai": "^4.3.4",
|
||||
|
||||
@ -3,7 +3,7 @@ const fs = require("fs");
|
||||
//let appdir = path.join(__dirname, "..");
|
||||
let app = {};
|
||||
|
||||
app.__config = require("./config")
|
||||
app.__config = require("./config");
|
||||
app.config = app.__config.getConfig();
|
||||
|
||||
function escapeRegExp(string) {
|
||||
@ -29,7 +29,7 @@ app.render = function (pagecode, templatecode) {
|
||||
if (pagecode != null || pagecode != undefined) {
|
||||
try {
|
||||
pagecode = JSON.parse(pagecode);
|
||||
} catch{}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
//TODO
|
||||
@ -54,8 +54,11 @@ app.render = function (pagecode, templatecode) {
|
||||
for (let i in pagecode) {
|
||||
let value = undefined;
|
||||
|
||||
let re = new RegExp(/\d*_([A-Z]|[a-z])\w*_/g);
|
||||
if (re.test(i)) continue;
|
||||
if ( new RegExp(/\d*_([A-Z]|[a-z])\w*_/g).test(i)) continue;
|
||||
if (new RegExp(/js\$([A-Z]*[a-z]*)\w+/g).test(i)) {
|
||||
let SE = require("./scriptExecuter");
|
||||
pagecode[i] = SE(pagecode[i]);
|
||||
}
|
||||
|
||||
value = pagecode[i].toString();
|
||||
templatecode = replaceAll(templatecode, "<[" + i + "]>", value);
|
||||
|
||||
@ -11,6 +11,8 @@ function Added() {
|
||||
}
|
||||
|
||||
function exec(script) {
|
||||
let result = undefined;
|
||||
|
||||
script = "".concat(
|
||||
Added.toString().replace(/^function\s*\S+\s*\([^)]*\)\s*\{|\}$/g, ""),
|
||||
script
|
||||
@ -18,9 +20,14 @@ function exec(script) {
|
||||
|
||||
script += "\n return outString;";
|
||||
|
||||
let F = new Function(script);
|
||||
try {
|
||||
let F = new Function(script);
|
||||
|
||||
return F();
|
||||
result = F();
|
||||
} catch (error) {
|
||||
result = error;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = exec;
|
||||
|
||||
@ -38,6 +38,27 @@ function test() {
|
||||
result.should.equal("EXAMPLEEXAMPLE");
|
||||
});
|
||||
|
||||
it.skip("blub", function () {
|
||||
let result = JSSTE_Engine.render(
|
||||
{
|
||||
js$test: `out('<h1>'+ Date.now().toString() + '</h1>')`,
|
||||
test: "hallo",
|
||||
js$test2: `test2`,
|
||||
_STYLES_: ["./test/style"],
|
||||
},
|
||||
`<html>
|
||||
<head>
|
||||
<title><[test]></title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
</head>
|
||||
<body>
|
||||
<[js$test2]>
|
||||
</body>
|
||||
</html>`
|
||||
);
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
it("should not rendern _VAR_", function () {
|
||||
let template = "<[_VAR_]>";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user