exclude development posts from production
This commit is contained in:
parent
a500811c53
commit
9a93331c68
@ -26,10 +26,6 @@
|
|||||||
so we have to use the :global(...) modifier to target
|
so we have to use the :global(...) modifier to target
|
||||||
all elements inside .content
|
all elements inside .content
|
||||||
*/
|
*/
|
||||||
.content :global(h2) {
|
|
||||||
font-size: 1.4em;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content :global(pre) {
|
.content :global(pre) {
|
||||||
background-color: #f9f9f9;
|
background-color: #f9f9f9;
|
||||||
|
@ -4,11 +4,18 @@ import { basename } from 'path'
|
|||||||
import fm from 'front-matter'
|
import fm from 'front-matter'
|
||||||
import marked from 'marked'
|
import marked from 'marked'
|
||||||
|
|
||||||
|
const { NODE_ENV } = process.env
|
||||||
|
|
||||||
export async function get(req, res) {
|
export async function get(req, res) {
|
||||||
const files = await promisify(readdir)(`_posts/blog/`, 'utf-8')
|
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(
|
const contents = await Promise.all(
|
||||||
files.map(async file => {
|
filteredFiles.map(async file => {
|
||||||
const fileContent = await promisify(readFile)(
|
const fileContent = await promisify(readFile)(
|
||||||
`_posts/blog/${file}`,
|
`_posts/blog/${file}`,
|
||||||
'utf-8'
|
'utf-8'
|
||||||
|
@ -11,13 +11,6 @@
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 2.8em;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 0.5em 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
figure {
|
figure {
|
||||||
margin: 0 0 1em 0;
|
margin: 0 0 1em 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user