Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created March 2, 2016 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/83a5c523204058175f2e to your computer and use it in GitHub Desktop.
Save tmcw/83a5c523204058175f2e to your computer and use it in GitHub Desktop.
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