Skip to content

Cupboard is an extension to Flatiron Plates templating library. It will recurse through a folder creating an object tree which matches the directory layout. All html files will be loaded from disk, and plates map and bind function become available on the returned objects.

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 

Cupboard

Build Status

Cupboard is a wrapper around Plates. It loads templates from disk and wraps them in an object with a map and bind function.

npm install plates-cupboard

Usage

To use Cupboard, tell it where to find your template folder.

var cupboard = require('cupboard');

var templates = cupboard('./templates');

Cupboard will recurse through the folder creating an object tree which matches the directory layout. All html files will be loaded from disk, and plates map and bind function become available on the returned objects.

For example, assuming the following directory structure:

	templates
		dashboard
			index.html

You'd be able to do this with Cupboard:

var templates = cupboard('./templates/'),
	data = { home: '/home' };

templates.dashboard.index.map.where('href').is('/').insert('home'); // call Plates' map functions
templates.dashboard.index.bind(data); // call Plates' bind function. templates.dashboard.index.map is passed in internally.

Notes

All file operations are performed synchronously. As such, it's best to use Cupboard when your app starts.

About

Cupboard is an extension to Flatiron Plates templating library. It will recurse through a folder creating an object tree which matches the directory layout. All html files will be loaded from disk, and plates map and bind function become available on the returned objects.

Resources

Releases

No releases published

Packages

No packages published