Merge pull request #4 from LordMathis/drafts

Drafts
This commit is contained in:
Matúš Námešný 2018-08-12 15:54:44 +02:00 committed by GitHub
commit 98ae765a08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -40,6 +40,11 @@ function compilePost(filepath, data, fileData, callback) {
const rendered = render(frontMatter.body); const rendered = render(frontMatter.body);
const metadata = fileMetadata(filepath); const metadata = fileMetadata(filepath);
if (frontMatter.attributes.draft) {
callback(null, null);
return;
}
let published; let published;
if (frontMatter.attributes.date) { if (frontMatter.attributes.date) {
published = moment(frontMatter.attributes.date); published = moment(frontMatter.attributes.date);
@ -99,9 +104,13 @@ Compiler.prototype.addFile = function(filepath, isPost, callback) {
], (err, result) => { ], (err, result) => {
if (err) throw err; if (err) throw err;
if (result == null) {
callback();
} else {
this.data.posts.push(result); this.data.posts.push(result);
console.log("[Compiler] File %s compiled", filepath); console.log("[Compiler] File %s compiled", filepath);
callback(); callback();
}
}); });
} else { } else {
async.waterfall([ async.waterfall([

View File

@ -68,7 +68,7 @@ const config = {
new webpack.HotModuleReplacementPlugin(), new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(), new webpack.NoEmitOnErrorsPlugin(),
new webpack.NamedModulesPlugin(), new webpack.NamedModulesPlugin(),
new ManifestPlugin({'writeToFileEmit': true}) new ManifestPlugin({'writeToFileEmit': true}),
] ]
} }
module.exports = config module.exports = config