component-render
Render html file from template file for component
Installation
With Component previously installed:
$ npm install -g component-render
Usage
Usage: component-render [options] <template>
Options:
-V, --version
-h, --help output usage information
-l, --local <json> local <json> file
-o, --out <path> output html file <path>
-u, --use <name> use the given render <name> plugin
Example
# redner html file from template file
$ component render simple.jade
# render html file from template file with local json file
$ component render -l user.json user.jade
# render html file to output path
$ component render -o ./static/html/simple.html simple.jade
# render html file with plugin
$ component render -u component-render-hogan -l user.json user.mustache
Template engine
Use Jade
template engine. Hogan
, EJS
, and other template engine, you can support with plugin.
How to create plugin
You need to implement below function.
- Function have
template
,program
andfn
arugments. template
: a template file path.program
:commander
object.fn
: a callback function. specifyerror
,html
to arguments.
Plugin example
var hogan = ;var path = ;var fs = ; module { var local = {}; if programlocal var resolve_path = path; local = fs ? : ; fs;};
License
See the LICENSE
.