exclude development posts from production

This commit is contained in:
Michal Vanko 2019-12-28 18:20:11 +01:00
parent a500811c53
commit 9a93331c68
5 changed files with 8 additions and 12 deletions

View File

@ -26,10 +26,6 @@
so we have to use the :global(...) modifier to target
all elements inside .content
*/
.content :global(h2) {
font-size: 1.4em;
font-weight: 500;
}
.content :global(pre) {
background-color: #f9f9f9;

View File

@ -4,11 +4,18 @@ import { basename } from 'path'
import fm from 'front-matter'
import marked from 'marked'
const { NODE_ENV } = process.env
export async function get(req, res) {
const files = await promisify(readdir)(`_posts/blog/`, 'utf-8')
const filteredFiles =
NODE_ENV !== 'production'
? files
: files.filter(file => !file.startsWith('dev-'))
const contents = await Promise.all(
files.map(async file => {
filteredFiles.map(async file => {
const fileContent = await promisify(readFile)(
`_posts/blog/${file}`,
'utf-8'

View File

@ -11,13 +11,6 @@
margin: 0 auto;
}
h1 {
font-size: 2.8em;
text-transform: uppercase;
font-weight: 700;
margin: 0 0 0.5em 0;
}
figure {
margin: 0 0 1em 0;
}