Skip to content

Instantly share code, notes, and snippets.

@oscarotero
Created March 5, 2017 19:24
Show Gist options
  • Save oscarotero/9628cb6971036a85d70b50bc0229ef2e to your computer and use it in GitHub Desktop.
Save oscarotero/9628cb6971036a85d70b50bc0229ef2e to your computer and use it in GitHub Desktop.
const through = require('through2');
const matter = require('front-matter');
module.exports = function () {
return through.obj(function (file, encoding, callback) {
callback(null, run(file));
});
}
function run (file) {
file.data = matter(String(file.contents));
return file;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment