JavaScript plugin for dynamic template decorating from declarative attributes
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
director.coffee
director.js
example.html

README.md

Director.js

A dinky template plugin for $ (either jQuery or Zepto with the data module) and _ (either Underscore or Lo-Dash). Director.js lets your define dynamic decorator functions as objects in a declarative data-direct attribute. It was created out of necessity for a reusable pattern for sprucing up liberally cached templates.

Quick Example

<div id="menu" data-direct='{"find":"#dashboard a","css":{"color": "red"}}'>
  <ul>
    <li id="dashboard"><a href="#">Dashboard</a></li>
    <li id="timeline"><a href="#">Timeline</a></li>
    <li id="profile"><a href="#">Profile</a></li>
  </ul>
</div>

When you call director.direct() the following JavaScript will get automatically executed:

$("#menu").find("#dashboard a").css({color: "red"})

Check the blog post and example.html for more info and examples.