如何让 CSS 变量在 Dart 中工作
How to get CSS Variables working in Dart
我在网上找过这个,但找不到有效的例子。有人可以指导我让 CSS 变量在 Dart 中工作吗?
资源:
http://www.w3.org/TR/css-variables/
有人提到了 csslib,但我没有看到每个解决方案:
https://github.com/dart-lang/sdk/issues/16710
https://github.com/dart-lang/csslib/issues/9
我正在尝试让这个在聚合物组件内部工作:
:host {
--text-color: #4f1f91;
}
.someLabel {
color: var(--text-color);
}
我知道我可以使用 dart/polymer 变量并执行如下操作:
.someLabel {
color: {{ polymerVar }};
}
但是,为什么 CSS 变量在 08/2015 上不起作用??
Firefox 是目前唯一原生支持 CSS 变量的浏览器 http://caniuse.com/#feat=css-variables
Polymer 1.0 为其他浏览器提供了一个 polyfill。 Polymer.dart 0.17(Polymer.js 1.0 的 Dart 端口)目前处于 alpha 状态,但它已经可以进行试验(参见最后的 dart-polymer 问题)。
我不知道没有 Polymer 是否可以使用 polyfill。
我在网上找过这个,但找不到有效的例子。有人可以指导我让 CSS 变量在 Dart 中工作吗? 资源: http://www.w3.org/TR/css-variables/ 有人提到了 csslib,但我没有看到每个解决方案: https://github.com/dart-lang/sdk/issues/16710 https://github.com/dart-lang/csslib/issues/9
我正在尝试让这个在聚合物组件内部工作:
:host {
--text-color: #4f1f91;
}
.someLabel {
color: var(--text-color);
}
我知道我可以使用 dart/polymer 变量并执行如下操作:
.someLabel {
color: {{ polymerVar }};
}
但是,为什么 CSS 变量在 08/2015 上不起作用??
Firefox 是目前唯一原生支持 CSS 变量的浏览器 http://caniuse.com/#feat=css-variables Polymer 1.0 为其他浏览器提供了一个 polyfill。 Polymer.dart 0.17(Polymer.js 1.0 的 Dart 端口)目前处于 alpha 状态,但它已经可以进行试验(参见最后的 dart-polymer 问题)。 我不知道没有 Polymer 是否可以使用 polyfill。