/platifyJs

a simple lightweight open source templating library in JavaScript

Primary LanguageJavaScript

platifyJs

A simple lightweight open source templating library in JavaScript

usage

  • Clone the platify.js library and link it in your html file using the JavaScript script tag:
  <script src="assets/platify.js"></script> 

Below is an example usuage for Platify Javascript Library. An index.html file

    <!-- index.html -->
  <h1 id="element">%{content}% </h1>

The main.js file contians the following code

//main.js
//initialize platify class
//then reference the element to map for variables
let platify = new Platify();
platify.template("body");
<!--index.html-->
<body>
<h1>%[key]%</h1>
</body>

usage

<!--index.html-->;
<body>
<h1>%[content]%</h1>
</body>
//main.js
let content = "Hello World!";


let platify = new Platify(values);
platify.mount('#element');
output:>
Hello World!

Syntax

//main.js

your values object
let value = { object elements };
let platify = new Platify(values);
platify.mount(mounting element);
  <!-- index.html -->
<h1 id="mounting element">%{the object element}% </h1>

platify.mount('#root');

let platify = new Platify(); platify.template('body');

output:>
Hello World!