Sass 映射和缩进语法 [英] Sass mappings and indented syntax
问题描述
有没有办法缩进 Sass 的 3.3 映射?
Is there a way to indent Sass' 3.3 mappings?
在 scss 中我们可以这样写:
In scss we can write following:
$colors: (
header: #b06,
text: #334,
footer: #666777
)
但是在 Sass 中,我不能在括号中添加任何中断.我认为在映射语法中需要括号.
But in Sass I cannot add any break into parentheses. I think that parentheses is required into mappings syntax.
$colors:
header: #b06
text: #334
footer: #666777
Syntax error: Illegal nesting: Nothing may be nested beneath variable declarations.
我尝试了一些变体,但编译时没有任何错误.
I tried some variances and nothing was compiled without errors.
为了编译 Sass,我需要把它写成这样的一个字符串:
To compile Sass I need to write it into one string like this:
$colors: (header: #b06, text: #334, footer: #666777)
但它不是缩进语法.
我认为将仅缩进的内容写入 SCSS 文件然后导入它们将是一个很好的演练.
推荐答案
SASS 中的缩进语法存在许多问题.
There is number of issues with the indented syntax in SASS.
不幸的是,SASS 语法不支持多行.阅读文档,只有一个例外,当涉及到多个 CSS 选择器时,如本例所示:
Unfortunately SASS syntax doesn't support Multi-line. Reading the documentation, there is only one exception, when it comes to multiple CSS selectors like in this example:
.users #userTab,
.posts #postTab
width: 100px
height: 30px
在此处阅读完整的文档:
Read the complete documentation here:
http://sass-lang.com/docs/yardoc/file.INDENTED_SYNTAX.html#multiline_selectors
因此,SASS 中的参数列表不可能获得多行支持.
So, there is no possibility to get multi-line support for an argument list in SASS.
这篇关于Sass 映射和缩进语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!