Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

LiveView v0.1

Templates from the semantic HTML you would have written anyways.

Table of Contents


LiveView is a pure HTML clean templating engine that supports realtime modification of data displayed through the template. Basically, it allows you to make awesome, real-time web apps. ALL of the awesome, real-time web apps.

LiveView tries to solve the same problems as traditional templating systems and then some. Rather than generating static markup, LiveView generates a DOM structure that allows you to update your template and its data on the fly, all while preserving event handlers and any associated data. This makes the view portion of creating realtime web apps a breeze!

LiveView is the result of taking all of the techniques I was using to update the DOM and wrapping them up in a nice template-like interface. It also depends on jQuery. This could change, but I always use jQuery, so it's not high on my priority list.

When parts of your web app change rapidly, it's super useful. If your pages don't update very often, you can probably get away with just inserting HTML fragment strings into the document.

If you want a system that doesn't clobber your events, associated data, and element references, LiveView might be for you.

API docs

You can find the API docs in the docs folder.

Experimental API docs

Experimental API docs will be made available when any part of the project isn't experimental.


###I have this html, make it live!

<div id = "myView">
  <div class = "currentTime"></div>


// set it to the current time
var view = new LiveView("#myView", {
  "currentTime": (new Date()).toTimeString()
// and update it every second!
setInterval(function() {
  view.set("currentTime", (new Date()).toTimeString());
}, 1000);

###Other templating systems allow me to use conditionals!

It's true, conditionals are important, and we've got em! Here's an example.

Markup first:

<div id = "conditional">
  <div class = "switch">
    You can't see me if switch is set to false!

And then a bit of js:

var view = new LiveView("#conditional", {
  switch: false //strict boolean false, NOT any falsy value

turn it back on:

view.set("switch", true);
// OR

One thing to note, is that conditionals are REMOVED from the document when they are set to false, they're not just set to display:none;.

###Dude I need to set the href attribute on a link

Setting attributes is another one of those things that you'll probably need to do. Luckily, you can!

<div id = "attribute">
  <a href = "#{link}"></a>
  <img src = "#{imagesrc}" alt = "#{imagealt}">

And JS:

var view = new LiveView("#attribute", {
  link: {href: "", content: "The googz"}
  image: {src: "/images/mycoolpic.png", alt: "A sweet pic"}


<div id = "attribute">
  <a class = "link" href="#{theLink}"></a>
  <img class = "image">

And it works with any html attribute, need I say more?

###I have a list of blog posts, how do I show all of them?

Naturally, any template system is going to have to handle blocks, or iterables, or each statements, whatever you want to call them. Here's how you do it with LiveView.

<div id = "list">
  <ul class = "posts">
    <li class = "post"> <!-- I like having the class post, but it's not neccessary -->
      <div class = "title"></div>

The markup must be a container div, with the class name the same as the data's name and ONE child element inside of it, which may or may not have a class, up to you.

Some JS:

var view = new LiveView("#list", {
  posts: [{title: "A post"}, 
          {title: "Another post"},
          {title: "ANOTHER ONE!"}]

// We can add them on the fly too!

var post = view.posts.append({title: "Incoming Post"})
//we can even change it!
post.set("title", "Changed")

That's it, consider it block'd.


Ideas, feature requests, bug reports, etc are very welcome.

###TODO Before we can release

  • scoping with thing.whatever syntax
  • get tests running with mocha
  • remove stupid features
  • documentation
  • IE8 Support


  • Zach Smith @xcoderzach
  • Eugene Butler @EButlerIV


MIT Licensed (see LICENSE.txt)