Polymer share styles across elements

前端 未结 4 2021
别那么骄傲
别那么骄傲 2020-11-29 13:03

I need to share styles across multiple Polymer elements. Is it acceptable to create a \"styles.html\" file and then import that into my different elements or would this star

4条回答
  •  既然无缘
    2020-11-29 13:31

    As of Polymer 1.1, the polymer project authors recommend creating and importing a style module to address this issue.

    To share style declarations between elements, you can package a set of style declarations inside a element. In this section, a holding styles is called a style module for convenience.

    A style module declares a named set of style rules that can be imported into an element definition, or into a custom-style element.

    See more: https://www.polymer-project.org/1.0/docs/devguide/styling#style-modules

提交回复
热议问题