mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-07 03:48:01 +02:00
fix: do not hardcode siteConfig path (#1150)
* Fix broken build Do not hardcode path in require to siteConfig * Just require instead of loadConfig * Actually use loadConfig I think the test may be wrong too. * refactor & nits * jest mock to fix test * fix test
This commit is contained in:
parent
71824a3541
commit
c78a8b4262
5 changed files with 19 additions and 11 deletions
|
@ -9,7 +9,6 @@ const autoprefixer = require('autoprefixer');
|
|||
const postcss = require('postcss');
|
||||
const path = require('path');
|
||||
const escapeStringRegexp = require('escape-string-regexp');
|
||||
const siteConfig = require('../../website/siteConfig.js');
|
||||
|
||||
function getSubDir(file, refDir) {
|
||||
const subDir = path.dirname(path.relative(refDir, file)).replace(/\\/g, '/');
|
||||
|
@ -74,10 +73,7 @@ function replaceAssetsLink(oldContent, location) {
|
|||
}
|
||||
return fencedBlock
|
||||
? line
|
||||
: line.replace(
|
||||
/\]\(assets\//g,
|
||||
`](${siteConfig.baseUrl}${location}/assets/`,
|
||||
);
|
||||
: line.replace(/\]\(assets\//g, `](${location}/assets/`);
|
||||
});
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue