Product Promotion
0x5a.live
for different kinds of informations and explorations.
GitHub - jasonmoo/t.js: A tiny javascript templating framework in ~400 bytes gzipped
A tiny javascript templating framework in ~400 bytes gzipped - jasonmoo/t.js
Visit SiteGitHub - jasonmoo/t.js: A tiny javascript templating framework in ~400 bytes gzipped
A tiny javascript templating framework in ~400 bytes gzipped - jasonmoo/t.js
Powered by 0x5a.live ๐
t.js
A tiny javascript templating framework in ~400 bytes gzipped
t.js
is a simple solution to interpolating values in an html string for insertion into the DOM via innerHTML
.
Features
- Simple interpolation:
{{=value}}
- Scrubbed interpolation:
{{%unsafe_value}}
- Name-spaced variables:
{{=User.address.city}}
- If/else blocks:
{{value}} <<markup>> {{:value}} <<alternate markup>> {{/value}}
- If not blocks:
{{!value}} <<markup>> {{/!value}}
- Object/Array iteration:
{{@object_value}} {{=_key}}:{{=_val}} {{/@object_value}}
- Multi-line templates (no removal of newlines required to render)
- Render the same template multiple times with different data
- Works in all modern browsers
How to use
var template = new t("<div>Hello {{=name}}</div>");
document.body.innerHtml = template.render({name: "World!"});
For more advanced usage check the t_test.html
.
This software is released under the MIT license.
Coffeescript version maintained by @davidrekow
PHP version maintained by @ramon82
JavaScript Resources
are all listed below.
GitHub - kenshin54/popline: Popline is an HTML5 Rich-Text-Editor Toolbar
resource
~/github.com
resource
GitHub - buunguyen/topbar: Tiny & beautiful site-wide progress indicator
resource
~/github.com
resource
GitHub - visionmedia/move.js: CSS3 backed JavaScript animation framework
resource
~/github.com
resource
GitHub - jDataView/jBinary: High-level API for working with binary data.
resource
~/github.com
resource
Made with โค๏ธ
to provide different kinds of informations and resources.