mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 07:37:19 +02:00
fix(v2): only import prism css on browser
This commit is contained in:
parent
f37300a69b
commit
261ab9254d
2 changed files with 8 additions and 2 deletions
|
@ -27,10 +27,16 @@ module.exports = async function(content) {
|
|||
return callback(err);
|
||||
}
|
||||
|
||||
let importStr = '';
|
||||
// If webpack target is web, we can import the css
|
||||
if (this.target === 'web') {
|
||||
importStr = `import '${options.prismTheme}';`;
|
||||
}
|
||||
|
||||
const code = `
|
||||
import React from 'react';
|
||||
import { mdx } from '@mdx-js/react';
|
||||
import '${options.prismTheme}';
|
||||
${importStr}
|
||||
${result}
|
||||
`;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue