From 3e574aa3f7ad2b19ea357a66d30afc24cf3fd1f9 Mon Sep 17 00:00:00 2001 From: yutent Date: Thu, 29 Dec 2022 18:02:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A0=B7=E5=BC=8F=E8=A7=A3?= =?UTF-8?q?=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/compile-vue.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/compile-vue.js b/lib/compile-vue.js index 13f1167..5a1afe2 100644 --- a/lib/compile-vue.js +++ b/lib/compile-vue.js @@ -58,9 +58,9 @@ export function compileScss(file, mini = true) { let style = mini ? 'compressed' : 'expanded' try { if (fs.isfile(file)) { - return scss.compile(file, { style, ...OPTIONS }).css + return scss.compile(file, { style, ...OPTIONS }).css.trim() } else { - return scss.compileString(file, { style, ...OPTIONS }).css + return scss.compileString(file, { style, ...OPTIONS }).css.trim() } } catch (err) { console.error(err) @@ -177,13 +177,11 @@ export function compileVue(file, imports, options = {}, isBuild) { }) js += ` - let stylesheet = new CSSStyleSheet() - stylesheet.path = '${file.slice( - options.IS_MPA ? options.pagesDir.length : options.root.length - )}' - stylesheet.replaceSync(\`${scss.join('\n')}\`) - document.adoptedStyleSheets.push(stylesheet) - ` +let stylesheet = new CSSStyleSheet() +stylesheet.path = '${file.slice(options.IS_MPA ? options.pagesDir.length : options.root.length)}' +stylesheet.replaceSync(\`${scss.join(' ')}\`) +document.adoptedStyleSheets.push(stylesheet) + ` } return js