namespace-context
Use with Assemble, Verb, or Templates.js to easily add namespaced variables like
page
orpost
to the context. This allows you to use{{page.title}}
instead of{{title}}
to get the current page's title. Can be used with verb, assemble v0.6.0, or any application based on Templates.js.
Install
Install with npm:
$ npm install namespace-context --save
Usage
In the example, app
is assemble, verb, or any templates-based application. Just replace app
with your application of choice.
var namespace = ;var assemble = ;var app = ; // create the `page` namespaceapp; // use the `page` variable in templatesapp ;
Custom collections
Works the same way with custom view collections.
var app = ;app; // create the `post` namespaceapp; // use the `post` variable in templatesapp ;
Related projects
- assemble: Assemble is a powerful, extendable and easy to use static site generator for node.js. Used… more | homepage
- expand: Recursively resolve templates in an object, string or array. | homepage
- template: Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… more | homepage
- verb: Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… more | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Building docs
Generate readme and API documentation with verb:
$ npm install verb && npm run docs
Or, if verb is installed globally:
$ verb
Running tests
Install dev dependencies:
$ npm install -d && npm test
Author
Jon Schlinkert
License
Copyright © 2016 Jon Schlinkert Released under the MIT license.
This file was generated by verb, v0.9.0, on February 25, 2016.