ecomfe / est

EFE Styling Toolkit based on Less
http://ecomfe.github.io/est
MIT License
397 stars 70 forks source link

est-layout-sidebar问题 #42

Closed ghost closed 8 years ago

ghost commented 8 years ago
body {
    .est-layout-sidebar(left, 200px, "#main", ".sidebar");
}

上面的代码编译结果是:

body {
  position: relative;
}
body > "#main" {
  overflow: hidden;
  margin-left: 200px;
}
body > ".sidebar" {
  position: absolute;
  top: 0;
  left: 0;
  width: 200px;
}

这样不能用吧,因为编译出来的body的子代选择器带有"",应该是没有冒号的。

zmmbreeze commented 8 years ago

根据首页的文档,正确的用法应该是:

body {
    .est-layout-sidebar(left, 200px, ~"#main", ~".sidebar");
}

因为选择器一般有特殊字符需要使用转义操作:~"#main",另外双引号不是表示字符串,会直接输出的。 输出的结果是:

body {
  position: relative;
}
body > #main {
  overflow: hidden;
  margin-left: 200px;
}
body > .sidebar {
  position: absolute;
  top: 0;
  left: 0;
  width: 200px;
}