Skip to content
This repository has been archived by the owner on Jan 1, 2018. It is now read-only.

Latest commit

 

History

History
50 lines (31 loc) · 1.54 KB

README.md

File metadata and controls

50 lines (31 loc) · 1.54 KB

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.

DEPRECATED

This module is deprecated - its design is flawed so I've stopped maintaining it. Use gulp-attach-to-template instead.

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