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

最近やってること.pdf

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

 最近やってること.pdf

Avatar for Tomohiko Himura

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 }; };