Package Exports
- get-view
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (get-view) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
get-view

Utility for getting an assemble view from a collection object.
(TOC generated by verb using markdown-toc)
Install
Install with npm:
$ npm i get-view --save
Usage
Should work with any collection of vinyl files.
var getView = require('get-view');
templates example
Given the following setup code, all of the below examples would return a page
from the app.views.pages
collection:
var templates = require('templates');
app = templates();
app.create('page');
app.page('foo', {content: 'this is foo'});
app.page('bar.md', {content: 'this is bar'});
app.page('a/b/c/baz.md', {content: 'this is baz', base: 'a'});
app.page('test/fixtures/templates/a.tmpl');
Get a view by customizing the lookup key with a function:
var view = getView('foo.md', app.views.pages, function(key) {
return path.basename(key, path.extname(key));
});
//=> <Page "foo" <Buffer 74 68 69 73 20 69>>
Get a view by view.path
var view = getView('a/b/c/baz.md', app.views.pages);
//=> <Page "b/c/baz.md" <Buffer 74 68 69 73>>
Get a view by view.basename
var view = getView('baz.md', app.views.pages);
//=> <Page "b/c/baz.md" <Buffer 74 68 69 73>>
Get a view by view.filename
var view = getView('baz', app.views.pages);
//=> <Page "b/c/baz.md" <Buffer 74 68 69 73>>
Get a view by view.relative
var view = getView('b/c/baz.md', app.views.pages);
//=> <Page "b/c/baz.md" <Buffer 74 68 69 73>>
Related projects
- assemble: Assemble is a powerful, extendable and easy to use static site generator for node.js. Used… more | homepage
- gulp: The streaming build system | homepage
- match-file: Returns true when the given
name
matches any of the path properties on a vinyl… more | homepage - templates: System for creating and managing template collections, and rendering templates with any node.js template engine.… more | homepage
- verb: Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… more | homepage
- vinyl: A virtual file format | homepage
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright © 2016 Jon Schlinkert Released under the MIT license.
This file was generated by verb on January 21, 2016.