SASS:使用材料变量(来自angular2)

时间:2016-12-26 10:50:33

标签: css sass

在材料主题中有这样的代码:

$md-indigo: (
  50: #e8eaf6,
  100: #c5cae9,
  200: #9fa8da,
  300: #7986cb,
  400: #5c6bc0,
  500: #3f51b5,
  ...
)

.text-overflow {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

如何在其他文件中我可以使用这个变量(跳过导入规则)?

例如:

.someclass {
    color: $md-indigo-500;
    .text-overflow();
}

1 个答案:

答案 0 :(得分:1)

您可以在.text-overflow中使用.someclass作为

.someclass {
    color: $md-indigo-500;
    @extend .text-overflow;
}