From 00134f0fe2eaaed91339acb2b8a293a691d2f95f Mon Sep 17 00:00:00 2001 From: Oj Date: Thu, 22 Apr 2021 21:31:34 +0100 Subject: [PATCH] [PCPlugin] Fix various issues in loadStylesheet replacing --- src/preprocessors/pcPlugin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/preprocessors/pcPlugin.js b/src/preprocessors/pcPlugin.js index a4e8ae0..1158301 100644 --- a/src/preprocessors/pcPlugin.js +++ b/src/preprocessors/pcPlugin.js @@ -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); }