1.0.0 • Published 8 years ago
stratic-post-to-json-data v1.0.0
stratic-post-to-json-data
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
.
Installation
npm install stratic-post-to-json-data
Usage
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).
JSON format
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
License
LGPL 3.0+
Author
Alex Jordan alex@strugee.net
1.0.0
8 years ago