We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, how can i append the data i get from front-matter to an existing json file? Here's what i have:
`gulp.task('meta', function(){ return gulp.src(path.posts) .pipe(plumber({ handleError: onError })) .pipe(frontMatter({ property: 'meta'})) //.pipe(data(function(file){ // file.meta.path = file.path // })) .pipe(pluck('meta', 'meta.json')) .pipe(data(function(file){ file.contents = new Buffer(JSON.stringify({'articles': file.meta}, null, ' ')); //var obj = JSON.parse(require './config.json'); //obj.articles = file.contents;
})) .pipe(gulp.dest('dev/articles/'))
});`
At the moment it outputs to a meta.json file, i'd like for it to append the data to an existing config.json under an "artilcles" key.
Thanks, Tiago
The text was updated successfully, but these errors were encountered:
This is from my project and works well.
.pipe(plugins.data(function (file) { let data = JSON.parse(fs.readFileSync(cacheFile)); data.currFile = path.basename(file.path); return data; })) .pipe(plugins.grayMatter())
Sorry, something went wrong.
No branches or pull requests
Hi, how can i append the data i get from front-matter to an existing json file? Here's what i have:
`gulp.task('meta', function(){
return gulp.src(path.posts)
.pipe(plumber({
handleError: onError
}))
.pipe(frontMatter({ property: 'meta'}))
//.pipe(data(function(file){
// file.meta.path = file.path
// }))
.pipe(pluck('meta', 'meta.json'))
.pipe(data(function(file){
file.contents = new Buffer(JSON.stringify({'articles': file.meta}, null, ' '));
//var obj = JSON.parse(require './config.json');
//obj.articles = file.contents;
});`
At the moment it outputs to a meta.json file, i'd like for it to append the data to an existing config.json under an "artilcles" key.
Thanks,
Tiago
The text was updated successfully, but these errors were encountered: