10

我的 main.sass 中有这个:

#thing 
{
       -moz-box-sizing:     border-box; 
    -webkit-box-sizing:     border-box; 
            box-sizing:     border-box;
}

编译时,sass 说:

Inconsistent indentation: 7 spaces were used for indentation, 
but the rest of the document was indented using 4 spaces.

有没有办法抑制这种情况?

4

1 回答 1

14

更新:看到您在问题中包含了花括号,我建议您尝试将文件的扩展名从 更改.sass.scss。SCSS 可能会忽略您的缩进,因为它可以根据花括号判断哪个部分在哪里。


SASS 依靠缩进来告诉您尝试在哪里应用您的 CSS,因此如果它在每一行中都不同,它将无法验证它。试试这个:

.something
    -webkit-box-sizing: border-box 
    -moz-box-sizing:    border-box
    box-sizing:         border-box

就个人而言,我什border-box至不会费心让它们都从同一列开始缩进,因为工作量太大而收获太少。作为替代方案,您可以编写一个 mixin 来为您执行此操作:

@mixin border-box
    -webkit-box-sizing: border-box
    -moz-box-sizing: border-box
    box-sizing: border-box

定义好后,直接包含即可:

.something
    @include border-box
于 2013-09-27T10:30:13.737 回答