https://github.com/niklaskorz/tumblate
A tumblr template rendering library
https://github.com/niklaskorz/tumblate
Last synced: about 1 month ago
JSON representation
A tumblr template rendering library
- Host: GitHub
- URL: https://github.com/niklaskorz/tumblate
- Owner: niklaskorz
- License: mit
- Created: 2016-01-17T22:47:04.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-18T12:07:14.000Z (over 10 years ago)
- Last Synced: 2025-01-11T03:54:09.671Z (over 1 year ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tumblate [](https://travis-ci.org/niklaskorz/tumblate)
A tumblr template rendering library.
Written in ES2015 and without dependencies.
## Why would I need this?
You probably don't. Unless you're working on development tools for tumblr template development, like me.
## Installation
Tumblate is available on npm. Just run:
npm install --save tumblate
## Examples
There are two ways to get started, either by creating a reusable instance of
the `Template` class or by using the `render` function.
```js
templateSrc = 'Welcome to {Title}.{block:Description} It is about: {Description}{/block:Description} Have a nice day!'
data = {
Title: 'My Blog',
Description: 'Nothing special. Just random things.'
}
// ES2015
import {Template, render} from 'tumblate';
let template = new Template(templateSrc);
console.log(template.render(data));
console.log(render(templateSrc, data));
// CommonJS
var tumblate = require('tumblate');
var template = new tumblate.Template(templateSrc);
console.log(template.render(data));
console.log(tumblate.render(templateSrc, data));
```
## Missing features
Tumblate is currently missing meta variables (i.e., user-definable variables like `{color:Content Background}`)
and parameters (e.g., `{Likes limit="5" summarize="100" width="150"}`).