Skip to content

Commit

Permalink
fix: node-sass 编译有时候无输出的 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Pines-Cheng committed Nov 22, 2018
1 parent 777b528 commit e011610
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/taro-cli/src/rn/styleProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function writeStyleFile ({css, tempFilePath}) {
const fileContent = `import { StyleSheet } from 'react-native'\n\nexport default StyleSheet.create(${css})`
fs.ensureDirSync(path.dirname(tempFilePath))
fs.writeFileSync(tempFilePath, fileContent)
Util.printLog(Util.pocessTypeEnum.GENERATE, '生成文件', tempFilePath)
}

module.exports = {
Expand Down
13 changes: 7 additions & 6 deletions packages/taro-plugin-sass/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ module.exports = function compileSass (content, file, config) {
file,
data: content
})
sass.render(opts, (err, result) => {
if (err) {
return reject(err)
}
resolve(result)
})
var result
try {
result = sass.renderSync(opts)
} catch (e) {
reject(e)
}
resolve(result)
})
}

0 comments on commit e011610

Please sign in to comment.