[PCPlugin] Fix various issues in loadStylesheet replacing

This commit is contained in:
Ducko 2021-04-22 21:31:34 +01:00 committed by Lexi Sother
parent 2bc4f3cf10
commit 00134f0fe2
No known key found for this signature in database
GPG Key ID: 355968D14144B739
1 changed files with 2 additions and 2 deletions

View File

@ -22,12 +22,12 @@ export default (manifestPath, repo) => {
content = content.replace(`module.exports = class`, `export default new class`);
content = content.replace(/this\.loadStylesheet\(['"`](.*)['"`]\)/g, (_, relative) => {
const path = manifestPath.split('/').slice(0, -1).join('/') + relative;
const path = manifestPath.split('/').slice(0, -1).concat('').join('/') + relative;
let css;
if (path.split('.').pop() === 'scss') {
css = (sass.renderSync({ file: path })).css;
css = (sass.renderSync({ file: path })).css.toString('utf8');
} else {
css = readFileSync(sync);
}