https://github.com/pinjasaur/templater.js
Minimal JavaScript templating with a tiny footprint
https://github.com/pinjasaur/templater.js
javascript-template-engine javascript-templates template-engine templating templating-engine
Last synced: about 1 month ago
JSON representation
Minimal JavaScript templating with a tiny footprint
- Host: GitHub
- URL: https://github.com/pinjasaur/templater.js
- Owner: Pinjasaur
- License: mit
- Created: 2016-06-12T03:54:59.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2025-02-16T18:12:39.000Z (3 months ago)
- Last Synced: 2025-04-15T06:08:24.051Z (about 1 month ago)
- Topics: javascript-template-engine, javascript-templates, template-engine, templating, templating-engine
- Language: JavaScript
- Homepage: http://pinjasaur.github.io/templater.js/
- Size: 303 KB
- Stars: 13
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# templater.js

[](https://github.com/Pinjasaur/templater.js)Dead-simple JavaScript templating with a tiny1 footprint. View the [website][homepage] for extended details & documentation.
Inspired by http://jsforallof.us/2014/12/01/the-anatomy-of-a-simple-templating-engine/ and http://krasimirtsonev.com/blog/article/Javascript-template-engine-in-just-20-line.
1 < 1KB minified + gzipped.
## Quick Start
1. Install the script
The script can be installed with [Bower][bower], [npm][npm], or by grabbing the [latest release][latest] from GitHub.
```sh
bower install templaterjs # For Bower
npm install templater.js # For npm
```2. Load in the script
If in a browser environment, with a `` tag
```html
<script src="path/to/templater.min.js">
```
Or, if in a Node.js environment with a `require()`
```js
var templater = require("templater.js");
```3. Create the template
```html
<h1>Hi, I'm {{name}}.</h1>
```4. Use template and render it against some data
```javascript
var template = templater(document.getElementById("template").innerHTML),
context = {
name: "Paul"
};console.log(template(context)); //
Hi, I'm Paul.
```## Documentation
For further documentation and resources, visit the [templater.js website][homepage].
## Contributing
If you'd like to fork the repo and submit pull request, please feel free.
Check out [CONTRIBUTING.md][CONTRIBUTING] for specifics.
[CONTRIBUTING]: https://github.com/Pinjasaur/templater.js/blob/master/CONTRIBUTING.md
[homepage]: http://pinjasaur.github.io/templater.js/
[bower]: https://bower.io/
[npm]: https://www.npmjs.com/
[latest]: https://github.com/Pinjasaur/templater.js/releases/latest