Gulp plugin to take a Vinyl file with Stratic post information (for example, something that's been parsed with stratic-parse-header
) and make the file contents JSON describing the post. This is particularly useful when paired with something like gulp-jade-template
.
This module is deprecated - its design is flawed so I've stopped maintaining it. Use gulp-attach-to-template instead.
npm install stratic-post-to-json-data
gulpfile.js
:
var gulp = require('gulp')
var straticParseHeader = require('stratic-parse-header');
var straticToJson = require('stratic-post-to-json-data');
gulp.task('parse', function() {
gulp.src('*.md')
.pipe(straticParseHeader())
.pipe(straticToJson());
});
Each file's contents are now JSON containing the post Markdown and associated metadata (title, author, timestamp and categories).
This plugin transforms file contents into a JSON object with the following properties:
text
(String
) - The post content (i.e. whatever the file's contents were before)
metadata
(Object
) — contains title
, author
, time
and categories
keys which are the same as in stratic-parse-header
LGPL 3.0+
Alex Jordan alex@strugee.net