## Usage Should work with any collection of vinyl files. ```js const getView = require('{%= name %}'); ``` **[templates][] example** Given the following setup code, all of the below examples would return a view from the `app.views.pages` collection: ```js const 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: ```js const view = getView(app.views.pages, function(view) { return view.stem === 'foo.md'; }); //=> > ``` Get a view by `view.path` ```js const view = getView(app.views.pages, 'a/b/c/baz.md'); //=> > ``` Get a view by `view.basename` ```js const view = getView(app.views.pages, 'baz.md'); //=> > ``` Get a view by `view.filename` ```js const view = getView(app.views.pages, 'baz'); //=> > ``` Get a view by `view.relative` ```js const view = getView(app.views.pages, 'b/c/baz.md'); //=> > ``` ## Release history ### v2.0 **Breaking changes** - The order of arguments has been reversed, so that the collection of views is passed first, and the lookup value is second. - No longer matches with globs. This can be done by passing a glob matcher as the second argument.