From f9fe82bd565d8c53be4fe84ff237d9e3aeae4c82 Mon Sep 17 00:00:00 2001 From: Pavel Mineev Date: Sun, 1 Aug 2021 20:11:31 +0300 Subject: [PATCH] Disable injection of last-comments.css in dev ...because it handled by webpack --- frontend/app/last-comments.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/app/last-comments.tsx b/frontend/app/last-comments.tsx index 78e394bc22..2f5acb3b96 100644 --- a/frontend/app/last-comments.tsx +++ b/frontend/app/last-comments.tsx @@ -35,10 +35,12 @@ async function init(): Promise { throw new Error('Remark42: Site ID is undefined.'); } - const styles = document.createElement('link'); - styles.href = `${BASE_URL}/web/last-comments.css`; - styles.rel = 'stylesheet'; - (document.head || document.body).appendChild(styles); + if (process.env.NODE_ENV === 'production') { + const styles = document.createElement('link'); + styles.href = `${BASE_URL}/web/last-comments.css`; + styles.rel = 'stylesheet'; + (document.head || document.body).appendChild(styles); + } (Array.from(nodes) as HTMLElement[]).forEach((node) => { const max = (node.dataset.max && parseInt(node.dataset.max, 10)) || max_last_comments || DEFAULT_LAST_COMMENTS_MAX;