1.1.0 • Published 8 years ago

ttemplate v1.1.0

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

ttemplate

npm npm Github file size npm

A tiny template engine.

Use CDN in browser

<script type="text/javascript" src="https://unpkg.com/ttemplate@1.0.0/ttemplate.min.js"></script>

Install

Install with npm:

$ npm install ttemplate

Install width bower

$ bower install ttemplate

Usage

es5, browser and es6 ready

var template = require('ttemplate');

template({
   charset: 'UTF-8',
   name: 'viewport',
   content: 'width=device-width'
}, '<meta charset="<%=charset%>"><meta name="<%=name%>" content="<%=content%>">' );
// -> '<meta charset="UTF-8"><meta name="viewport" content="width=device-width">'

API

template ( json, html )

Parameters

json

Type: Object

the json format object

html

Type: String

html string with '<%=property%>'

Returns

Type: String

the html string

Example

var template = require('ttemplate');

template({
   charset: 'UTF-8',
   name: 'viewport',
   content: 'width=device-width'
}, '<meta charset="<%=charset%>"><meta name="<%=name%>" content="<%=content%>">' );
// -> '<meta charset="UTF-8"><meta name="viewport" content="width=device-width">'

Changes Log

https://github.com/yaohaixiao/typeofit/releases

Issues

https://github.com/yaohaixiao/ttemplate/issues

License

Licensed under MIT License.

1.1.0

8 years ago

1.0.0

8 years ago