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:
Joel Marcey 2018-12-07 10:09:25 -08:00 committed by Endilie Yacop Sucipto
parent 71824a3541
commit c78a8b4262
5 changed files with 19 additions and 11 deletions

View file

@ -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');
}