我有一些 SCSS 文件,它们的缩进以某种方式设法得到了很好的提升。
我试过做 Edit > Line > Reindent
并更改各种缩进设置,但似乎都无法正常工作。
是否有一致的方法来重新缩进 SCSS 文件?
我所看到的示例:
[role="main"] {
margin: 0 auto;
padding: 30px;
h1 {
text-align: center;
font-family: 'Exo';
font-weight: 200;
font-size: 3.5em;
margin: 8px 0 20px 0;
}
}
.hidden {
display: none;
}
.button, button {
@include button;
&.red {
@include button($red);
}
}
这发生在数千行 SCSS 中……我宁愿不必手动正确缩进。
最佳答案
选择所有内容,然后按 Ctrl-[ (Unindent) 几次以删除所有原始缩进。然后,使用 Edit -> Line -> Reindent
,它应该可以很好地工作。您的示例代码为我生成了这个:
[role="main"] {
margin: 0 auto;
padding: 30px;
h1 {
text-align: center;
font-family: 'Exo';
font-weight: 200;
font-size: 3.5em;
margin: 8px 0 20px 0;
}
}
.hidden {
display: none;
}
.button, button {
@include button;
&.red {
@include button($red);
}
}
关于sass - Sublime Text : Reindent SCSS files?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16542305/