Gulp Yaml Front Matter to JSON add File Name -
I'm not sure what the best way to go about it.
I would like to add a Example files Of course, there will be no return because it will be compact. Let me know something like Update , I created the plugin How it works here Is: end update < / P> Okay, take the time to take the time. Dependencies include: : and JavaScript Equivalent: yaml
front case to the
json from a markdown file by adding a file name to a single
Jason file.
bananas.md and
apples.md ,
--- title: Ban Type: yellow Calculation: - 1 - 2 - - # My Markdown file
Apple MD :
--- Title: Apple Type: Red Count: - 3 - 4 --- # My Markdown File 2
all.json :
[["title" "" "" "" "" "" "" "" " "," "Type": "yellow", "count": [1,2], "file": "banana"}, {"title": "apple", "type": "red", "count" [3,4], "file": "apple"}]
Gulppass Plugins have been found but do not seem to have them No one really wants what I want, even not even joint, as long as I'm missing something.
gulp-pluck , which is a very simple process.
var gulp = require ('gulp'); var data = required ('crypto data'); Var pluck = is required ('gulp-plaque') ; Var Frontimator = is required ('gulp-front-case'); Gulp.task ('front-matter-to-json', function) (return gulp.src ('./posts/ * .md') .pipe (frontmaker ({property: 'meta'})) .pipe (File (file.meta.path = file.path;}).) .pipe ('meta', 'post-metadata.jason')) .pipe (data (function (file) {file. Content = new Buffer (JSON.stringify (file.meta))}.) .pipe (gulp.dest ('dist')})
Gulp needs a built-in
low function!
cryptography, Filter ,
event-stream ,
stream-less , and
gulp-rename .
Gulpacakas 'constanm' - & gt; DevDest = './dev/public/' gulp.src './src/posts/*.md' .pipe filter post .pip front-case {property: 'meta'} .pipe es.map (file, cb) - & gt; File.meta.name = path.basename file.path file.meta.url = toUrlPath file.meta.name cb faucet, file. Reduce the pipe (ACC, file) - & gt; | Acc = & gt; Acc.meta.push File.meta acc | _ = & Gt; Acc = file acc.meta = [file.meta] ac), zero. Pipe es.map (file, cb) - & gt; File.contents = New buffer JSON.stringify file.meta cb null, Rename the file .pipe 'posts.json' .pipe gulp.dest devDest
Gulppasskas ('concatyaml', function) (var devDest; devDest = './dev/public/'; return gulp.src ('./src / posts / (file , Cb {file.meta.name = path} .pipe (filter) .pipe (front property ({property: 'meta'}) .pipe (es.map (function (file, cb) {file .meta.name = path (f, file) {switch (false) {decrease} (file). File (file); file meta.url = to url path (file.mata.name); return CB (tap, file );}). Mal: acc: acc.meta.push (file.meta); return ac; default: acc = file; acc.meta = [file.meta]; return ac;}}, zero 8)) .pipe (es.map (Function (file, cb) {file.contents = new buffer (JSON.stringify (file.meta)); return CB (faucet, file);}) .pipe (rename ('posts.json')). Pipes (Gulp.dest (devDest));});
Comments
Post a Comment