mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-31 23:40:39 +02:00
feat: add uglifyjs webpack plugin
This commit is contained in:
parent
ca623d7d38
commit
0365403a75
4 changed files with 37 additions and 9 deletions
|
@ -3,21 +3,19 @@ const fm = require('front-matter');
|
|||
|
||||
module.exports = function(fileString) {
|
||||
const options = getOptions(this);
|
||||
const {siteConfig, siteDir, docsDir } = options;
|
||||
|
||||
const {body} = fm(fileString);
|
||||
const content = JSON.stringify(body);
|
||||
/*
|
||||
TODO replace all the markdown linking to correct url depends on whether it's versioned/translated/normal docs
|
||||
e.g: [test](test.md) become [test](/docs/test)
|
||||
Process the markdown file content, including replacing all relative markdown links
|
||||
*/
|
||||
const siteConfig = JSON.stringify(options.siteConfig);
|
||||
|
||||
const {body: content = ''} = fm(fileString);
|
||||
|
||||
return (
|
||||
`import React from 'react';\n` +
|
||||
`import Markdown from '@theme/Markdown'\n` +
|
||||
`export default () => (
|
||||
<Markdown siteConfig={${siteConfig}}>
|
||||
{${content}}
|
||||
<Markdown siteConfig={${JSON.stringify(siteConfig)}}>
|
||||
{${JSON.stringify(content)}}
|
||||
</Markdown>
|
||||
);`
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue