Skip to content

Commit

Permalink
fix(plugin): 修复 less 和 stylus 不支持 @import, fix #231
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Jul 13, 2018
1 parent 95b136c commit 9afddc1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/taro-plugin-less/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ module.exports = function compileLess (content, file, config) {
if (!content) {
content = fs.readFileSync(file).toString()
}
less.render(content, config).then((res, imports) => {
config = config || {}
config.filename = file
less.render(content, config).then(res => {
resolve({ css: res.css, imports: res.imports })
}).catch(reject)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-plugin-stylus/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function compileStylus (content, file, config) {
const opath = path.parse(file)
config.paths = [opath.dir]
config.filename = opath.base
const instance = stylus(content)
const instance = stylus(content, { filename: file })
for (const k in config) {
instance.set(k, config[k])
}
Expand Down

0 comments on commit 9afddc1

Please sign in to comment.