mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-30 15:00:09 +02:00
fix(theme-classic): resolve customCss from site dir (#7363)
This commit is contained in:
parent
29b015de18
commit
c0bd145a29
2 changed files with 8 additions and 6 deletions
|
@ -5,6 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import path from 'path';
|
||||||
import type {LoadContext, Plugin} from '@docusaurus/types';
|
import type {LoadContext, Plugin} from '@docusaurus/types';
|
||||||
import type {ThemeConfig} from '@docusaurus/theme-common';
|
import type {ThemeConfig} from '@docusaurus/theme-common';
|
||||||
import {getTranslationFiles, translateThemeConfig} from './translations';
|
import {getTranslationFiles, translateThemeConfig} from './translations';
|
||||||
|
@ -142,11 +143,11 @@ export default function themeClassic(
|
||||||
];
|
];
|
||||||
|
|
||||||
if (customCss) {
|
if (customCss) {
|
||||||
if (Array.isArray(customCss)) {
|
modules.push(
|
||||||
modules.push(...customCss);
|
...(Array.isArray(customCss) ? customCss : [customCss]).map((p) =>
|
||||||
} else {
|
path.resolve(context.siteDir, p),
|
||||||
modules.push(customCss);
|
),
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return modules;
|
return modules;
|
||||||
|
|
|
@ -337,7 +337,8 @@ const config = {
|
||||||
theme: {
|
theme: {
|
||||||
customCss: [
|
customCss: [
|
||||||
require.resolve('./src/css/custom.css'),
|
require.resolve('./src/css/custom.css'),
|
||||||
require.resolve('./_dogfooding/dogfooding.css'),
|
// relative paths are relative to site dir
|
||||||
|
'./_dogfooding/dogfooding.css',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
gtag: !isDeployPreview
|
gtag: !isDeployPreview
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue