hbs-blog
Version:
handlebarjs helper to generate blog pages and navigations
26 lines (20 loc) • 515 B
JavaScript
module.exports = loadDocumentData
var Through = require('through2')
var ReadDocumentData = require('../lib/read-document-data')
/**
* @returns {object}
*/
function loadDocumentData () {
return Through.obj(function (file, enc, cb) {
var fileContent = file.contents.toString()
if (!file.data) {
file['data'] = {}
}
Object.assign(
file['data'],
{relativePath: file.relative},
ReadDocumentData(fileContent, null)
)
cb(null, file)
})
}