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.
Failed to load latest commit information.


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"}}'>
    <li id="dashboard"><a href="#">Dashboard</a></li>
    <li id="timeline"><a href="#">Timeline</a></li>
    <li id="profile"><a href="#">Profile</a></li>

When you call 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.