Created
March 2, 2016 18:17
-
-
Save tmcw/83a5c523204058175f2e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOMServer from 'react-dom/server'; | |
import App from './components/app'; | |
import remark from 'remark'; | |
import slug from 'remark-slug'; | |
import content from './content'; | |
import fs from 'fs'; | |
var ast = remark().use(slug).run(remark().parse(content)); | |
var template = fs.readFileSync('./template.html', 'utf8'); | |
fs.writeFileSync('./index.html', | |
template.replace('APP', | |
ReactDOMServer.renderToString( | |
<App ast={ast} content={content} />))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment