text-import-engine
v1.0.9
Published
a barebones text templating engine for javascript (with tie-fighters)
Downloads
4
Maintainers
Readme
Text Import Engine
Purpose
TIE is a barebones text templating engine. It was originally intended to be used to render server-side html templates; however it can easily be utilised to create templates for any markup, programming, or plain language with the power of dynamic javascript.
Getting Started
To start using TIE in your project simply install with npm i text-import-engine
and import the module import Tie from "text-import-engine"
.
Usage
TIE as of now has one function Tie.render(string, object)
it takes two arguments: the first being the string to be modified, and second being an object containing the data TIE should use to modify the aforementioned string. The syntax to show TIE where in the text these modifications should take place is simple |o| example |o|
where 'example' is a key in the data object.
Examples
Using TIE syntax within a string
<p>hello |o| name |o| nice to see you again</p>
Creating a data object
const data = {name: 'jordan'}
Calling TIE's render function
Tie.render('<p>hello |o| name |o| nice to see you again</p>', data)
returns: <p>hello jordan nice to see you again</p>