1.3.3 • Published 1 year ago

jsste v1.3.3

Weekly downloads
-
License
GPL
Repository
github
Last release
1 year ago

JSSTE

npm NPM Downloads

NPM

Desciption

JSSTE is a NodeJS-Module for rendering data in static HTML

Usage

Installation

You can jsste install using npm or yarn.

npm install jsste
yarn add jsste

including in your project

const jsste = require("jsste");

Rendering

jsste.render(pagecode, tempaltecode);

Example

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>

Special Variables

  • _TEMPLATE_ -> Defines the path to the temp file
  • _STYLES_ -> Defines a list of CSS files that will be implemented

Include States

You can include an Callbackfunction that will be called when the state is change

jsste.setStateFunction(({ status, statusMSG }) => {
  yourstatus = status;
  yourstatusMSG = statusMSG;
});

States-Codes

CodeMeaning
0OK
1ERROR
2WARNING
3INFO
4DEBUG

Commandline

Installation

npm install jsste -g

or

yarn install jsste -g

excuting

jsste <argument>
arguemntdescriptionExample
-logshow 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
-infoshow jsste.info
-outwrite rendered code into the commandling

Example

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>

Examples on https://github.com/lucaspalomodevelop/JSSTE-Examples

1.2.0

2 years ago

1.3.3

1 year ago

1.3.2

1 year ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago