Ver código fonte

Add doctype before render to make valid html

Add doctype to html string
Trinh Hoang Nhu 9 anos atrás
pai
commit
9400f6bfb7
1 arquivos alterados com 1 adições e 1 exclusões
  1. 1 1
      tools/render.js

+ 1 - 1
tools/render.js

@@ -40,7 +40,7 @@ async function renderPage(page, component) {
     body: ReactDOM.renderToString(component),
   };
   const file = join(__dirname, '../build', page.file.substr(0, page.file.lastIndexOf('.')) + '.html');
-  const html = ReactDOM.renderToStaticMarkup(<Html debug={DEBUG} {...data} />);
+  const html = '<!DOCTYPE html>' + ReactDOM.renderToStaticMarkup(<Html debug={DEBUG} {...data} />);
   await fs.mkdir(dirname(file));
   await fs.writeFile(file, html);
 }