diff --git a/hyperglass/ui/pages/_document.tsx b/hyperglass/ui/pages/_document.tsx index 8865bde..ab3053d 100644 --- a/hyperglass/ui/pages/_document.tsx +++ b/hyperglass/ui/pages/_document.tsx @@ -13,8 +13,14 @@ interface DocumentExtra extends DocumentInitialProps { class MyDocument extends Document { static async getInitialProps(ctx: DocumentContext): Promise { const initialProps = await Document.getInitialProps(ctx); - const customJs = fs.readFileSync('custom.js').toString(); - const customHtml = fs.readFileSync('custom.html').toString(); + let customJs = '', + customHtml = ''; + if (fs.existsSync('custom.js')) { + customJs = fs.readFileSync('custom.js').toString(); + } + if (fs.existsSync('custom.html')) { + customHtml = fs.readFileSync('custom.html').toString(); + } return { customJs, customHtml, ...initialProps }; }