Implement draft support

This commit is contained in:
LordMathis 2018-08-12 12:41:28 +02:00
parent 6935867a12
commit 84f706bf30
2 changed files with 15 additions and 4 deletions

View File

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

View File

@ -1,6 +1,7 @@
const { resolve, join } = require('path')
const webpack = require('webpack')
const ManifestPlugin = require('webpack-manifest-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin')
const config = {
mode: 'development',
@ -68,7 +69,8 @@ const config = {
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.NamedModulesPlugin(),
new ManifestPlugin({'writeToFileEmit': true})
new ManifestPlugin({'writeToFileEmit': true}),
new CleanWebpackPlugin(['public/static'], {}),
]
}
module.exports = config