Create a simple blog from markdown files with Webpack!
blog-loader is a Webpack loader that imports markdown files with yaml-frontmatter, and
returns formatted HTML and meta data from the frontmatter.
Usage
Add the webpack loader:
{ test: /blog\/.*md/, loader: "blog-loader", query: { // Required keys in the frontmatter required: [ 'author', 'category', 'date', 'title'], // Where to save the markdown files, if at all. name: 'blog/[name].[ext]' } },
And start writing markdown files:
--- Author: Assertible Title: "`blog-loader` for Webpack" Category: Cool stuff Date: 2018-09-14 --- This is getting recursive.
Then import them:
import blogPost from './blogPost.md' console.log(blogPost) => { title: ..., author: ..., category: ..., date: ..., content: "This is getting recursive." }
That's it!
License
The code in this repository is licensed under MIT. View the license
assertible.com · GitHub @assertible · Twitter @AssertibleApp