This project is under heavy development, and the API has not solidfied yet. Don't use this for anything important...yet.
Bind data to DOM with zero configuration. Just call
$'#template'fillproject: 'Fill'details:githubLink: _text: 'Fill' _href: ''features:_style: 'color:green'li:'Uses plain HTML with no extra templating markup''Runs on the client or server (with jsdom)''Render arrays without loops or partials''Nested objects and collections''Compatible (tested on IE6+, Chrome and Firefox)';
FillFillUses plain HTML with no extra templating markupRuns on the client or server (with jsdom)Render arrays without loops or partialsNested objects and collectionsCompatible (tested on IE6+, Chrome and Firefox)
npm install fill or get the
compiled and minified version
and include it to your application. jQuery is optional, but if you happen to
use it, fill registers itself as a plugin.
For server-side use, see
spec folder and the awesome
jsdom for the details.
name attribute and
data-bind attribute. Values are escaped before rendering.
Any keys that are prefixed with an underscore are treated as attributes (with
the exception of _text and _html).
var hello =_class: 'message'hello: 'Hello'goodbye: 'Goodbye!'span: '<i>See Ya!</i>'greeting: 'Howdy!''hi-label': 'Terve!' // Finnish i18n;// with jQuery$'#container'fillhello;// ..or withoutfilldocumentgetElementById'container' hello;
var activities =activity:'Jogging''Gym''Sky Diving';$'#activities'fillactivities;// orfilldocumentgetElementById'activities' activities;
var comments =body: "That rules"body: "Great post!"$'.comment'fillcomments;
commentThat rulescommentGreat post!
var post =title: 'Hello World'post: 'Hi there it is me'comment:name: 'John'text: 'That rules'name: 'Arnold'text: 'Great post!';$'.container'fillpost;
Hello WorldHi there it is meJohnThat rulesArnoldGreat post!
var person =firstname: 'John'lastname: 'Wayne'address:street: '4th Street'city: 'San Francisco'zip: '94199';$'.person'fillperson;
JohnWayne4th Street94199San Francisco
// prefix with a dollar sign to find all matches// otherwise it will only find the first onevar post =$hello: 'hi';$'.container'fillpost;
You need node.js 0.6.x and npm.
npm install npm install -g uglify-js
Run tests during development for more verbose assertion output
node_modules/jasmine-node/bin/jasmine-node --verbose spec
All the following are appreciated, in an asceding order of preference
In case the contribution is going to change fill API, please create a ticket first in order to discuss and agree on design.
This project was forked from the very impressive Transparency project to attempt the following: