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 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([
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const { resolve, join } = require('path')
|
const { resolve, join } = require('path')
|
||||||
const webpack = require('webpack')
|
const webpack = require('webpack')
|
||||||
const ManifestPlugin = require('webpack-manifest-plugin');
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
||||||
|
const CleanWebpackPlugin = require('clean-webpack-plugin')
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
mode: 'development',
|
mode: 'development',
|
||||||
|
@ -68,7 +69,8 @@ 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}),
|
||||||
|
new CleanWebpackPlugin(['public/static'], {}),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
module.exports = config
|
module.exports = config
|
||||||
|
|
Loading…
Reference in New Issue