
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template helpers, middleware, routes, loaders, and lots more. Powers assemble, verb and other node.js apps.
Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template helpers, middleware, routes, loaders, and lots more. Powers assemble, verb and other node.js apps.
(Table of contents generated by verb)
Install with npm
$ npm i template --save
See to the API documentation.
Create a new instance of Template
with the given `options.
Params
options
{Object}Example
var app = require('template')();
Load data onto app.cache.data
Params
key
{String|Object}: Key of the value to set, or object to extend.val
{any}returns
{Object}: Returns the instance of Template
for chainingExample
console.log(app.cache.data);
//=> {};
app.data('a', 'b');
app.data({c: 'd'});
console.log(app.cache.data);
//=> {a: 'b', c: 'd'}
Create a new Views
collection.
Params
returns
{Object}: Returns the instance for chaining.Example
app.create('foo');
app.foo('*.hbs');
var view = app.foo.get('baz.hbs');
Handle middleware for the given view
and locals.
Params
method
{String}: Router VERBview
{Object}: View objectlocals
{Object}cb
{Function}returns
{Object}Example
app.handle('customHandle', view);
Compile content
with the given locals
.
Params
view
{Object|String}: View object.locals
{Object}isAsync
{Boolean}: Load async helpersreturns
{Object}: View object with fn
property with the compiled function.Example
var blogPost = app.post('2015-09-01-foo-bar');
var view = app.compile(blogPost);
// view.fn => [function]
Render content
with the given locals
and callback
.
Params
file
{Object|String}: String or normalized template object.locals
{Object}: Locals to pass to registered view engines.callback
{Function}Example
var blogPost = app.post('2015-09-01-foo-bar');
app.render(blogPost, function(err, view) {
// `view` is an object with a rendered `content` property
});
Install dev dependencies:
$ npm i -d && npm test
Install devDependencies:
npm i -d && verb
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright © 2014-2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on August 19, 2015.
FAQs
Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template helpers, middleware, routes, loaders, and lots more. Powers assemble, verb and other node.js apps.
The npm package template receives a total of 1,444 weekly downloads. As such, template popularity was classified as popular.
We found that template demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.