diff --git a/lib/main.js b/lib/main.js index d25abf1..ede1a1e 100644 --- a/lib/main.js +++ b/lib/main.js @@ -47,14 +47,17 @@ export default function compile(root = '', isProd = false, es) { { let code = fs.cat(filePath).toString() console.log('编译 %s ...', blue(file)) - code = Es.transformSync(code, OPTIONS).code.replace( - /css`([\w\W]*?)`/g, - function (m, scss) { - scss = compileScss(scss) - return `css\`${scss}\`` - } - ) + try { + code = Es.transformSync(code, OPTIONS).code + } catch (err) { + console.log('compile scss: ', file) + console.error(err) + } + code = code.replace(/css`([\w\W]*?)`/g, function (m, scss) { + scss = compileScss(scss) + return `css\`${scss}\`` + }) fs.echo(code, target) } break diff --git a/lib/utils.js b/lib/utils.js index bf442f8..6fe1590 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -24,5 +24,6 @@ export function compileScss(file, mini = true) { } catch (err) { console.log('compile scss: ', file) console.error(err) + return '' } } diff --git a/package.json b/package.json index 020e72c..a8ae1a8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@bd/wcui-cli", "type": "module", - "version": "1.1.0", + "version": "1.2.0", "bin": { "wcui-cli": "index.js" },