0.0.1 • Published 12 years ago
ajt v0.0.1
AJT (Ajax JSON Template)
How simple can it be to do an Ajax-Request, get JSON and put this into a template? Simple and lightweight: 3 KB!
ajt('http://yourapi.com/getjson', 'theTemplate', function (html) {
document.getElementById('placeholder').innerHTML = html;
});and your template is a vanillaJS compiled jade template :) - does that sound sweet? It does!
h2= value1
code= value2That it, simple and intuitiv!
Documentation
ajt is looking for three parameters, the request URL, the templateID and the callback. Everything else is done by ajt.js.
Bundling
You can eitherway bundle it by using the node module, or the command line:
var ajt = require('ajt');
var js = ajt(__dirname + '/jadeTemplates', './optionalOutputfilename.js');
// ...$ ajt -t jadeTemplates -o myoutput.js
or
$ ajt -t jadeTemplatesYou even can do:
$ ajt -t jadeTemplates -t moreTemplates -o myoutput.jsContributors
- milafrerichs - he kind of had the idea ;)
0.0.1
12 years ago