Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用sass语法,编译器报错 #208

Closed
zhuowenli opened this issue Jun 19, 2017 · 5 comments
Closed

使用sass语法,编译器报错 #208

zhuowenli opened this issue Jun 19, 2017 · 5 comments
Labels

Comments

@zhuowenli
Copy link

[email protected] 设置 <style lang="sass"> 使用sass语法,编译器会报错。

.home
    background: #fff
    .swiper
        width: 100%
        height: 280rpx
        overflow: hidden
        &-image
            width: 100%

错误日志:

{ Error: Invalid CSS after ".": expected 1 selector or at-rule, was ".home"
    at options.error (/Users/zhuowenli/demo/weapp-demo/node_modules/node-sass/lib/index.js:292:26)
  status: 1,
  file: '/Users/zhuowenli/demo/weapp-demo/src/pages/index.sass',
  line: 1,
  column: 1,
  message: 'Invalid CSS after ".": expected 1 selector or at-rule, was ".home"',
  formatted: 'Error: Invalid CSS after ".": expected 1 selector or at-rule, was ".home"\n        on line 1 of src/pages/index.sass\n>> .home\n   ^\n' }

但是代码却仍然可以正常编译到 index.wxss 中,应该是 node-sass 配置有问题,望解决!

@zhuowenli
Copy link
Author

zhuowenli commented Jun 19, 2017

#43 应该是同一个问题

Gcaufy added a commit that referenced this issue Jun 29, 2017
@Gcaufy
Copy link
Collaborator

Gcaufy commented Jun 29, 2017

@zhuowenli 已修复,在未发布版本之前,在wepy.config.js中加入配置:

sass: {
    indentSyntax: true
}

也可以解决这个问题。

@Gcaufy Gcaufy self-assigned this Jun 30, 2017
@Gcaufy Gcaufy added the bug label Jun 30, 2017
@Gcaufy
Copy link
Collaborator

Gcaufy commented Aug 5, 2017

fixed in 1.5.8

@Gcaufy Gcaufy closed this as completed Aug 5, 2017
dlhandsome pushed a commit to dlhandsome/wepy that referenced this issue Aug 16, 2017
@jswxwxf
Copy link

jswxwxf commented Jan 10, 2018

到底应该怎么配置啊?怎么我现在用的是1.6.0还是会报这样的错?
`<style lang="sass">
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
&-avatar {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
}
&-nickname {
color: #aaa;
}
}
</style>

[Error] Error: Invalid CSS after " ": expected 1 selector or at-rule, was "{"
at options.error (/Users/wangxifeng/Programs/VSCProjects/mina/node_modules/node-sass/lib/index.js:291:26)
`

@Gcaufy
Copy link
Collaborator

Gcaufy commented Jan 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants