0.0.4 • Published 12 years ago
jaderunner v0.0.4
jaderunner
Simple package for executing Jade templates from the command-line.
Install
npm install --save jaderunnerUsage
jaderunner [-a <asset_home>] [-j <json_data>] <template_file> <output_file> ["json_string"]- If
-ais set use<asset_home>for global path to other Jade assets, otherwise use the value of theASSET_HOMEenvironment variable - Loads and compiles the Jade template
<template_file> - If
-jis specified, read<json_data>as locals - If
"json_string"is present, evaluate it and add result to locals - Execute template using locals
- Write output HTML to
<output_file>
Examples
// Execute simple.jade and write to out.html
jaderunner simple.jade out.html
// The same, using default extensions
jaderunner simple out
// Supply some locals to the template
jaderunner simple out "{title:'The title',x:42}"
// Read locals from data.json
jaderunner -j data.json simple out
jaderunner -j data simple outAPI
jaderunner.compile(string, object)
Example: jaderunner.compile('template.jade')
Loads and compiles a Jade template, returning an object with the keys:
source_file: file name of Jade templatesource: source of templateoptions: compilation optionsfunc(object): Jade compiled template functionrender(string, object): runs the template with theobjectas its locals, and writes the output to the file given by the first parameter
E.g.
var tmpl = jaderunner.compile('simple.jade');
tmpl.render('output.html', {
title: 'My title'
});License
MIT © James Skinner