velocity.java
Apache Velocity is a general purpose template engine.
This is a nodejs wrap for Apache Velocity.
Requirements
- JRE 1.6 or higher
API
velocity.renderOnce(filename[, data][, root], callback)
- filename String
- data Object
- root String | Array
- callback Function
Render the template specified by filename
with data
.
root
accepts multi-value.
Root(s) from which the loader loads templates.
Templates may live in subdirectories of this root.
filename
is the relative path to root
.
Example:
var velocity = ;velocity;
The callback is passed two arguments (err, data)
,
where data
is the buffer of the rendered template.
velocity.startServer([port][, callback])
- port Number default = 12306
- callback Function
callback
, test whether the JRE exists. Then call the callback
argument with either true or false.
velocity.stopServer()
velocity.render(filename[, data][, root], callback)
- filename String
- data Object
- root String | Array
- callback Function
Java startup time is often much slower,
because a lot of classes must be loaded before being used.
So, velocity.java
provides one simple server to speed up rendering.
render
usually used after startServer
. Example:
var velocity = ;velocity;velocity;