Skip to content

Extends vinyl files with properties used in vinyl-collections.

License

Notifications You must be signed in to change notification settings

jonschlinkert/vinyl-item

Repository files navigation

vinyl-item NPM version NPM downloads Build Status

Extends vinyl files with properties used in vinyl-collections.

Install

Install with npm:

$ npm install vinyl-item --save

Usage

Use the same way you would use a vinyl file:

var Item = require('vinyl-item');
var item = new Item({path: 'foo'});

API

Create an instance of Item. Optionally pass a default object to use. See vinyl docs for API details and additional documentation.

Params

  • item {Object}

Example

var item = new Item({
  path: 'foo.html',
  contents: new Buffer('...')
});

Normalize the content and contents properties on item. This is done to ensure compatibility with the vinyl convention of using contents as a Buffer, as well as the assemble convention of using content as a string. We will eventually deprecate the content property.

Example

var item = new Item({path: 'foo/bar.hbs', contents: new Buffer('foo')});
console.log(item.content);
//=> 'foo'

Getter/setter to resolve the name of the engine to use for rendering.

Example

var item = new Item({path: 'foo/bar.hbs'});
console.log(item.engine);
//=> '.hbs'

Related projects

You might also be interested in these projects:

  • assemble: Assemble is a powerful, extendable and easy to use static site generator for node.js. Used… 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

Contributing

This document was generated by verb, please don't edit directly. Any changes to the readme must be made in .verb.md. See Building Docs.

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 -g verb verb-readme-generator && 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 June 01, 2016.

About

Extends vinyl files with properties used in vinyl-collections.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published