pages/_document: fix get antd css
This commit is contained in:
parent
9824621230
commit
a3ee025c23
@ -1,18 +1,12 @@
|
||||
import getUrls from '@/config/urls';
|
||||
|
||||
const { BASE_PATH } = getUrls();
|
||||
|
||||
function buildPath(filePath) {
|
||||
return String.prototype.concat(BASE_PATH, filePath);
|
||||
}
|
||||
import { withBasePath } from '@/config/urls';
|
||||
|
||||
export const metaFavicon = (
|
||||
<>
|
||||
<link rel="apple-touch-icon" sizes="180x180" href={buildPath('/apple-touch-icon.png')} />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href={buildPath('/favicon-32x32.png')} />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href={buildPath('/favicon-16x16.png')} />
|
||||
<link rel="manifest" href={buildPath('/site.webmanifest')} />
|
||||
<link rel="mask-icon" href={buildPath('/safari-pinned-tab.svg')} color="#5bbad5" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href={withBasePath('/apple-touch-icon.png')} />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href={withBasePath('/favicon-32x32.png')} />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href={withBasePath('/favicon-16x16.png')} />
|
||||
<link rel="manifest" href={withBasePath('/site.webmanifest')} />
|
||||
<link rel="mask-icon" href={withBasePath('/safari-pinned-tab.svg')} color="#5bbad5" />
|
||||
<meta name="theme-color" content="#ffffff" />
|
||||
</>
|
||||
);
|
||||
|
||||
@ -4,14 +4,13 @@ import getConfig from 'next/config';
|
||||
import { isServer } from 'tools/common';
|
||||
|
||||
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig();
|
||||
const { BASE_PATH } = publicRuntimeConfigSchema.parse(publicRuntimeConfig);
|
||||
|
||||
export function withBasePath(path: string) {
|
||||
return String.prototype.concat(BASE_PATH, path);
|
||||
}
|
||||
|
||||
function getUrls() {
|
||||
const { BASE_PATH } = publicRuntimeConfigSchema.parse(publicRuntimeConfig);
|
||||
|
||||
function withBasePath(url: string) {
|
||||
return BASE_PATH + url;
|
||||
}
|
||||
|
||||
if (isServer()) {
|
||||
const {
|
||||
URL_CRM_GRAPHQL_DIRECT,
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
|
||||
import { metaFavicon } from '@/config/meta';
|
||||
import { withBasePath } from '@/config/urls';
|
||||
import Document, { Head, Html, Main, NextScript } from 'next/document';
|
||||
import { ServerStyleSheet } from 'styled-components';
|
||||
import { createCache, doExtraStyle, StyleProvider } from 'ui/tools';
|
||||
@ -28,7 +29,7 @@ export default class MyDocument extends Document {
|
||||
styles: [
|
||||
initialProps.styles,
|
||||
sheet.getStyleElement(),
|
||||
fileName && <link rel="stylesheet" href={`/${fileName}`} />,
|
||||
fileName && <link rel="stylesheet" href={withBasePath(`/${fileName}`)} />,
|
||||
],
|
||||
};
|
||||
} finally {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user