Implement draft support
This commit is contained in:
parent
6935867a12
commit
84f706bf30
|
@ -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([
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue