Merge branch 'feat/ui-0.7.0' into 'test'

fix: doInsertCustomCSS

See merge request opensource/answer!360
This commit is contained in:
贾海涛(龙笛) 2022-12-17 19:20:01 +00:00
commit 84ea719a74
1 changed files with 7 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import { SWRConfig } from 'swr';
import { toastStore, brandingStore, pageTagStore } from '@/stores';
import { Header, Footer, Toast, Customize, CustomizeTheme } from '@/components';
const doInsertCustomCSS = !document.querySelector('link[href*="custom.css"]');
const Layout: FC = () => {
const { msg: toastMsg, variant, clear: toastClear } = toastStore();
const closeToast = () => {
@ -30,7 +31,12 @@ const Layout: FC = () => {
<title>{pageTitle}</title>
{keywords && <meta name="keywords" content={keywords} />}
{description && <meta name="description" content={description} />}
<link rel="stylesheet" href={`${process.env.PUBLIC_URL}/custom.css`} />
{doInsertCustomCSS && (
<link
rel="stylesheet"
href={`${process.env.PUBLIC_URL}/custom.css`}
/>
)}
</Helmet>
<CustomizeTheme />
<SWRConfig