   ServerReactRootIndex = require 'react/lib/ServerReactRootIndex'
   ServerReactRootIndex.createReactRootIndex = ->
     0
-  React = require 'react'
-  {AppView} = require './src/scripts/views/app-view'
   props =
     entries: [entry].filter (i) -> i
     entry: entry
     hasNext: false
     searchText: null # entry?.date ? null
     searchVisible: false # entry?
-  title = buildTitle entry
-  doctype = '<!DOCTYPE html>'
-  html = React.renderToStaticMarkup buildHtml(title, props)
-  fse.outputFileSync file, doctype + html
+  fse.outputFileSync file, buildHtmlAsString(props)
 
 ignoreError = (stream) ->
   stream.on 'error', (e) ->

    )
  )

buildHtml = (title, props) ->
  React.DOM.html(
    null
    buildHead(title, props)
    buildBody(props)
  )

buildTitle = (entry) ->
  titlePrefix = if entry?
    date = moment(entry.pubdate).format 'YYYY-MM-DD'
    date + ' ' + entry.title + ' - '
  else
    ''
  titlePrefix + 'blog.bouzuya.net'

loadEntries = (src) ->
  myjekyll = require 'myjekyll'

    React.DOM.script(src: '/scripts/main.js')
  )

buildHead = (props) ->
  entry = props.entry
  titlePrefix = if entry?
    date = moment(entry.pubdate).format 'YYYY-MM-DD'
    date + ' ' + entry.title + ' - '
  else
    ''
  title = titlePrefix + 'blog.bouzuya.net'
  React.DOM.head(
    null
    React.DOM.meta(charSet: 'UTF-8')
