简体   繁体   English

样式可重复使用的聚合物元素的策略

[英]strategies for styling a reusable Polymer element

I'm getting started with Polymer web components. 我开始使用Polymer Web组件。 We have a product that can be injected into multiple client applications, or could even be a standalone application. 我们提供的产品可以注入到多个客户端应用程序中,甚至可以是独立的应用程序。 This product is a game where the rules for validating correct answers and the general flow are the same throughout all implementations. 该产品是一款游戏,其中验证正确答案的规则和总体流程在所有实现中都相同。 The only variance is styling so the game looks like it belongs in its surroundings. 唯一的区别是样式,因此游戏看起来像是它的周围环境。

I'm tempted to use some of the cool Polymer Paper elements for the UI aspects of the various custom elements, but I do not want to force a particular design aesthetic. 我很想在各种自定义元素的UI方面使用一些很酷的Polymer Paper元素,但是我不想强加某种特殊的设计美感。 So, I think it will be a better choice to simply have each custom Polymer element to return semantic HTML. 因此,我认为将每个自定义Polymer元素简单地返回语义HTML会是一个更好的选择。

So, how can I allow the clients that are consuming the game to apply their own look and feel? 那么,如何允许正在消费游戏的客户应用自己的外观? In my research on Polymer, I've read about applying styles inside each element. 在对Polymer的研究中,我读到了有关在每个元素内应用样式的信息。 I suppose that might be OK for structural issues. 我想这对于结构性问题可能是可以的。 Does anyone have any strategies they've employed for custom CSS implementations for Polymer elements? 是否有人对Polymer元素的自定义CSS实现采用了任何策略?

Thank you. 谢谢。

Custom CSS Properties is the suggested way of theming Polymer Elements. 自定义CSS属性是建议的聚合物元素主题方式。 Here's a video from the polymer summit and another video of Rob Dodson talking about theming your elements using custom css properties. 这里有一个视频从聚合物峰会和另一个视频谈论主题化使用自定义的CSS属性的元素罗布多德森的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM