
Security News
Socket Security Analysis Is Now One Click Away on npm
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.
namespace-context
Advanced tools
Use with Assemble, Verb, or Templates.js to easily add namespaced variables like `page` or `post` 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 an
Use with Assemble, Verb, or Templates.js to easily add namespaced variables like
pageorpostto 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 with npm
$ npm i namespace-context --save
In the example, app is assemble, verb, or any Template-based application. Just replace app with your application of choice.
var namespace = require('namespace-context');
var assemble = require('assemble');
var app = assemble();
// create the `page` namespace
namespace('page', app);
// use the `page` variable in templates
app.page('abc.md', {content: '{{page.title}}'})
.render({title: 'Page Title'}, function (err, res) {
if (err) return done(err);
//=> 'Page Title'
});
Works the same way with custom view collections.
var app = assemble();
app.create('posts');
// create the `post` namespace
namespace('post', app);
// use the `post` variable in templates
app.post('abc.md', {content: '{{post.title}}'})
.render({title: 'Post Title'}, function (err, res) {
if (err) return done(err);
//=> 'Post Title'
});
Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on September 09, 2015.
FAQs
Use with Assemble, Verb, or Templates.js to easily add namespaced variables like `page` or `post` 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 an
We found that namespace-context demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.

Security News
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.

Product
Socket is now scanning AI agent skills across multiple languages and ecosystems, detecting malicious behavior before developers install, starting with skills.sh's 60,000+ skills.