Upgrade to Pro — share decks privately, control downloads, hide ads and more …

最近やってること.pdf

 最近やってること.pdf

Tomohiko Himura

September 15, 2018
Tweet

More Decks by Tomohiko Himura

Other Decks in Programming

Transcript

  1. const writeFilePage = async ({ filename, Page }: { filename:

    string, Page: Component }): Promise<{ path: string, html: string }> => { const content = ReactDOMServer.renderToStaticMarkup(<Page />); const html = `<!DOCTYPE html>${content}`; const path = `public/${filename}`; await fs.mkdirp(dirname(path)); await fs.writeFile(path, html); return { path, html }; };