Skip to content

Commit

Permalink
add drafts folder
Browse files Browse the repository at this point in the history
  • Loading branch information
maxboeck committed Feb 24, 2019
1 parent ff5c313 commit 6db1813
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 73 deletions.
9 changes: 5 additions & 4 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const filters = require('./_eleventy/filters.js')
const shortcodes = require('./_eleventy/shortcodes.js')

require('dotenv').config()
const env = process.env.NODE_ENV
const isProduction = process.env.NODE_ENV === 'prod'

module.exports = function(config) {
// Filters
Expand Down Expand Up @@ -69,11 +69,12 @@ module.exports = function(config) {

// Collections: Posts
config.addCollection('posts', function(collection) {
const pathsRegex = /\/posts\/|\/drafts\//
return collection
.getAllSorted()
.filter(item => item.inputPath.match(/\/posts\//) !== null)
.filter(item => item.inputPath.match(pathsRegex) !== null)
.filter(item => item.data.permalink !== false)
.filter(item => !(item.data.draft && env === 'prod'))
.filter(item => !(item.data.draft && isProduction))
})

// Collections: Notes
Expand All @@ -86,7 +87,7 @@ module.exports = function(config) {

// Minify HTML Output
config.addTransform('htmlmin', function(content, outputPath) {
if (env === 'prod' && outputPath.endsWith('.html')) {
if (outputPath.endsWith('.html') && isProduction) {
return htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
dist
functions
drafts
_cache
.env
69 changes: 0 additions & 69 deletions src/posts/css-mindset/2019-02-03-css-mindset.md

This file was deleted.

0 comments on commit 6db1813

Please sign in to comment.