A tiny helper library for using plate templates in Node point JS.
// myproject/index.jsvar porcelain =loader// automatically configures plate// to load templates from `myproject/templates/`// and returns a nice loader function.loader =// or you can specify your own directory,// relative to the current file (`myproject/mytemplates`)loader =// or multiple directories...loader =// or absolute directories.loader =// the loader can be used like a typical node.js callback function:// or to create readable streams suitable for piping// to responses!http// and they can be paused, if you need to do some extra work.http
npm install porcelain
plate to attempt to load templates from each of the provided
arguments. If the paths are relative (they do not begin with a
/), they will be
considered relative to the file of the caller.
Attempts to load a template given a name.
If successful, the callback will be called with
null as the first argument
plate.Template object as the second argument.
Return a readable stream suitable for piping to, e.g., a
Pause the stream. Headers and status code on the stream will not
be passed to any piped writable stream until
stream.resume() is called.
Resume the stream. Calls
ServerResponse the stream is piped to.
The context with which to render the loaded template with.
The HTTP status code to be set when piping to a
The headers (as a an object literal) to be set when piping to a