我需要在多个Polymer元素之间共享样式。创建“ styles.html”文件然后将其导入到我的其他元素中是否可以接受,还是随着应用程序的增长而开始对性能产生影响?我知道有0.5种核心样式,但是如果导入也能正常工作的话,这似乎是不必要的。
styles.html
<style>
button {
background: red;
}
</style>
Run Code Online (Sandbox Code Playgroud)
my-button.html
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../styles/main-styles.html">
<link rel="import" href="../behaviors/mixins.html">
<dom-module id="my-button">
<template>
<button>{{text}}</button>
</template>
</dom-module>
<script>
Polymer({
is: 'my-button',
behaviors: [ButtonBehavior]
})
</script>
Run Code Online (Sandbox Code Playgroud)