Created by: pugnascotia
This PR adds support for loading *.md
files through markdown-with-front-matter-loader
. This makes it simple to load and render Markdown through CRA.
Testing
- Create a demo app with
./tasks/cra.sh my-app-test
cd my-app-test
- Create
src/_posts/hello-world.md
--- title: 'Hello world' --- # Hello world This is a test ```javascript function() { } ```
- Modify
src/App.js
to load the file
import post from './_pages/hello-world.md';
- Include the post in the page:
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
<div dangerouslySetInnerHTML={{__html: post.__content}}></div>
- Start dev mode and check the page renders as expected.
yarn start
- Build a production bundle:
yarn run build
- Check that the production build works as expected by serving it and browsing http://localhost/
docker run -it --rm -v $PWD/build:/usr/share/nginx/html -p 80:80 nginx:alpine