JSSTE is a NodeJS-Module for rendering data in static HTML
You can jsste install using npm or yarn.
npm install jsste
yarn add jsste
const jsste = require("jsste");
jsste.render(pagecode, tempaltecode);
const templatecode = `
<html>
<head>
<title>JSSTE Example</title>
</head>
<body>
<h1><[VARNAME1]></h1>
<p><[VARNAME2]></p>
</body>
</html>
`;
const pagecode = { VARNAME1: "Hello World", VARNAME2: "This is a test" };
let result = Jsste.render(pagecode, templatecode);
// result
// <html>
// <head>
// <title>JSSTE Example</title>
// </head>
// <body>
// <h1>Hello World</h1>
// <p>This is a test</p>
// </body>
// </html>
_TEMPLATE_
-> Defines the path to the temp file_STYLES_
-> Defines a list of CSS files that will be implemented
You can include an Callbackfunction that will be called when the state is change
jsste.setStateFunction(({ status, statusMSG }) => {
yourstatus = status;
yourstatusMSG = statusMSG;
});
Code | Meaning |
---|---|
0 | OK |
1 | ERROR |
2 | WARNING |
3 | INFO |
4 | DEBUG |
npm install jsste -g
or
yarn install jsste -g
jsste <argument>
arguemnt | description | Example |
---|---|---|
-log | show jsste log | |
-Jsconfig= | set jsste config as json | |
-pageFile= | set pageFile path | |
-page= | set pageFile as json | |
-tempFile= | set tempFile path | |
-temp= | set pageFile as code | |
-info | show jsste.info | |
-out | write rendered code into the commandling |
const templatecode = `
<html>
<head>
<title>JSSTE Example</title>
</head>
<body>
<h1><[VARNAME1]></h1>
<p><[VARNAME2]></p>
</body>
</html>
`;
const pagecode = {"_STYLES_":["./main","./othercss"] "VARNAME1":"Hello World", "VARNAME2":"This is a test"};
let result = Jsste.render(pagecode, templatecode);
// result
// <html>
// <head>
// <title>JSSTE Example</title>
// <link rel="stylesheet" href="./main.css">
// <link rel="stylesheet" href="./othercss.css">
// </head>
// <body>
// <h1>Hello World</h1>
// <p>This is a test</p>
// </body>
// </html>