SemtexJS: Semantic Text Templating Engine
Semtex is a html templating engine.
All major changes are documented in the changelog
Quick start
The first step is to define a template:
html:
head:
meta[name="keywords",content="HTML,CSS,XML,JavaScript"]:
title: {{title}}
body:
p: Hello, {{message}}!
div:
lots of lovely content
to be placed here...
Once the template source code has been defined, the next step is to compile it into a render function. The actual template can be loaded any way you desire, providing that when it enters the compile()
function it's a string
:
var render = semtex.compile(src);
Now, all that's left to do is render the template into html, passing in any data the template requires:
var html = render({
title: 'Semtex example',
message: 'Semtex'
});
Which, given the template definition above, will produce the following output:
<html>
<head>
<meta name="keywords" content="HTML,CSS,XML,JavaScript"/>
<title>Semtex example</title>
</head>
<body>
<p>Hello, Semtex!</p>
<div>lots of lovely content to be placed here...</div>
</body>
</html>
Documentation
Coming soon...
Installation
Install via NPM
npm install semtex
Download a release
https://github.com/garydouble/semtex/releases
Browsers
UMD based files are located in the dist
folder:
semtex.js
Uncompressed development version.
semtex.min.js
Minified production version.
Both development and production files have source maps provided.
Issues and Contributions
https://github.com/garydouble/semtex/issues
Issues, feedback and pull requests all welcome.
Happy Coding!