Skip to content

Commit

Permalink
fixed sass indent syntax - #208
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcaufy committed Jun 29, 2017
1 parent 3a7744a commit a56c3c5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/wepy-cli/src/compile-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,29 @@ export default {
const scoped = style.scoped;
let filepath = style.src ? style.src : path.join(opath.dir, opath.base);

if (lang === 'scss')

let options = Object.assgin({}, config.compilers[lang] || {});

if (lang === 'sass' || lang === 'less') {
let indentedSyntax = false;
options = Object.assgin({}, config.compilers.sass || {});

if (lang === 'sass') { // sass is using indented syntax
indentedSyntax = true;
}
if (typeof options.indentedSyntax === undefined) {
options.indentedSyntax = indentedSyntax;
}
lang = 'sass';
}

let compiler = loader.loadCompiler(lang);

if (!compiler) {
throw `未发现相关 ${lang} 编译器配置,请检查wepy.config.js文件。`;
}

const p = compiler(content, config.compilers[lang] || {}, filepath).then((css) => {
const p = compiler(content, options || {}, filepath).then((css) => {
// 处理 scoped
if (scoped) {
// 存在有 scoped 的 style
Expand Down

0 comments on commit a56c3c5

Please sign in to comment.