SASS缩进语法多行? [英] SASS indented syntax on multiple lines?

查看:131
本文介绍了SASS缩进语法多行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢Sass的缩进语法(而不是SCSS,是空格不可知的,并使用括号和分号)。我认为它更干净。



我有一个问题。如果我有一个很长的行,没有办法把它拆分成多行(例如遵守80个字符的限制)



以这个例子一个很长的mixin

  @mixin col($ cols,$ mleft:0,$ mright:0,$ include -margin:false,$ border:0,
$ pleft:0,$ pright:0,$ include-padding:true,$ extra:0,
$ clear: $ container:false){
color:red;
display:block;
}

我可以将一个长声明拆分成多行。使用缩进的语法,我不认为有一种方法。我必须把声明放在一行,这是更不可读。

  @mixin col($ cols,$ mleft: 0,$ mright:0,$ include-margin:false,$ border:0,$ pleft:0,$ pright:0,$ include-padding:true,$ extra:0,$ clear:false,$ lead:true ,$ container:false)
color:red
display:block

有一些我不知道的方式? :(

解决方案

sass不支持Multiline。阅读文档时,有一个例外,当涉及到多个css选择器例如:

  .users #userTab,
.posts #postTab
width:100px
height:30px

在这里阅读文档: http://sass-lang.com/docs/yardoc/file.INDENTED_SYNTAX.html#multiline_selectors p>

所以,可悲的是:在sass中没有可能获得多行支持参数列表。


I love Sass's indented syntax (as opposed to SCSS, which is whitespace agnostic and uses brackets and semicolons). I think it's much cleaner.

There's one issue I have with it. If I have a really long line, there's no way to split it into multiple lines (obeying the 80 character limit, for example)

Take this example of a really long mixin declaration, first written in SCSS.

@mixin col($cols, $mleft: 0, $mright: 0, $include-margin: false, $border: 0,
           $pleft: 0, $pright: 0, $include-padding: true, $extra: 0, 
           $clear: false, $lead: true, $container: false) {
    color: red;
    display: block;
}

I'm able to split up one long declaration in to multiple lines. With the indented syntax, I don't think there's a way. I have to put the declaration on one line, which is way less readable.

@mixin col($cols, $mleft: 0, $mright: 0, $include-margin: false, $border: 0, $pleft: 0, $pright: 0, $include-padding: true, $extra: 0, $clear: false, $lead: true, $container: false)
    color: red
    display: block

Is there some way I don't know of? :(

解决方案

Multiline is not supported by sass. Reading the doc, there is one exception, when it comes to multiple css selectors like in this example:

.users #userTab,
.posts #postTab
  width: 100px
  height: 30px

Read the doc here: http://sass-lang.com/docs/yardoc/file.INDENTED_SYNTAX.html#multiline_selectors

So, sadly: There is no possibility to get multi-line support for an argument list in sass.

这篇关于SASS缩进语法多行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆