mirror of
https://github.com/lucaspalomodevelop/JSSTE.git
synced 2026-03-13 15:24:34 +00:00
JSSTE
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
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
Languages
JavaScript
100%
