Skip to content

Commit

Permalink
fix(theme-classic): resolve customCss from site dir (#7363)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena authored May 7, 2022
1 parent 29b015d commit c0bd145
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions packages/docusaurus-theme-classic/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import path from 'path';
import type {LoadContext, Plugin} from '@docusaurus/types';
import type {ThemeConfig} from '@docusaurus/theme-common';
import {getTranslationFiles, translateThemeConfig} from './translations';
Expand Down Expand Up @@ -142,11 +143,11 @@ export default function themeClassic(
];

if (customCss) {
if (Array.isArray(customCss)) {
modules.push(...customCss);
} else {
modules.push(customCss);
}
modules.push(
...(Array.isArray(customCss) ? customCss : [customCss]).map((p) =>
path.resolve(context.siteDir, p),
),
);
}

return modules;
Expand Down
3 changes: 2 additions & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ const config = {
theme: {
customCss: [
require.resolve('./src/css/custom.css'),
require.resolve('./_dogfooding/dogfooding.css'),
// relative paths are relative to site dir
'./_dogfooding/dogfooding.css',
],
},
gtag: !isDeployPreview
Expand Down

0 comments on commit c0bd145

Please sign in to comment.