GithubHelp home page GithubHelp logo

dustfly's Introduction

dustfly

  • Capable of precompiling a directory of dust templates recursively
  • Capable of creating a set of routes for Express 3 that...
    • Serve a whole directory of templates, precompiled as one file
    • Specific subdirectories, serving templates from that point and deeper
    • Specific precompiled templates
  • Optionally minify, namespace, filter input files
  • Mount any route as the base

Example usage:

var dustfly = require('dustfly')
  , app = require('express')();

dustfly(app, {
  root: 'views',                    // Default: ./views
  mount: 'templates',               // Default: templates
  namespace: false,                 // Default: false
  min: true,                        // Default: false
  filter: function(file){           // Default: none
    return ~file.indexOf('.public')
  }
});

app.listen(3000);

Given a directory structure:

views/
    child_view.dust
    parent_view.dust
    relative/
        relative_child_view.dust
        relative_parent_view.dust
        deep/
            deep_child_view.dust
            deep_parent_view.dust

curl localhost:3000/templates will contain:

  • child_view.dust
  • parent_view.dust
  • relative_child_view.dust
  • relative_parent_view.dust
  • deep_child_view.dust
  • deep_parent_view.dust

curl localhost:3000/templates/parent_view.dust will contain:

  • parent_view.dust

curl localhost:3000/templates/relative will contain:

  • relative_child_view.dust
  • relative_parent_view.dust
  • deep_child_view.dust
  • deep_parent_view.dust

curl localhost:3000/templates/relative/deep will contain:

  • deep_child_view.dust
  • deep_parent_view.dust

TODO:

  • Factor out getting combined template for a given directory into a function
  • Create a bin/dustfly command for combining templates statically
  • Support etags in express integration
  • Clean up code so aynch traversal isn't so butt ass ugly
  • Support a 'base' javascript file analagous to dust-core-1.0.0.min.js in http://linkedin.github.com/dustjs/
  • See if we can make this template engine agnostic with consolidate.js

dustfly's People

Contributors

jmoyers avatar

Watchers

 avatar James Cloos avatar

Forkers

tregusti

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.