修复样式解析

pull/1/head
yutent 2022-12-29 18:02:25 +08:00
parent 96bee5184a
commit 3e574aa3f7
1 changed files with 7 additions and 9 deletions

View File

@ -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,12 +177,10 @@ 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)
`
}