polymer 1.0:如何在另一个文件中存储重复的 <style></style> 部分?
polymer 1.0 : how to store repetitive <style></style> section in another file?
我有几个 dom 模块,所有这些模块都在其样式部分共享一些样式行。所以,我想将样式部分中的这些行存储到另一个文件中,然后加载到我的其他元素中。任何评论将不胜感激。
我知道 polymer 网站上有样式部分,但是对于没有 css 背景的人来说太难了。
提前致谢。
我想这就是您要找的东西
示例-style.html
<link rel="import" href="../bower_components/polymer/polymer.html">
<!-- shared styles for all elements and index.html -->
<dom-module id="example-style"> <!-- -->
<template>
<style>
<!-- insert styles here -->
</style>
</template>
</dom-module>
网络组件-name.html
将此行添加到您的自定义 Web 组件的模板中
<style include="example-style"></style>
我有几个 dom 模块,所有这些模块都在其样式部分共享一些样式行。所以,我想将样式部分中的这些行存储到另一个文件中,然后加载到我的其他元素中。任何评论将不胜感激。
我知道 polymer 网站上有样式部分,但是对于没有 css 背景的人来说太难了。
提前致谢。
我想这就是您要找的东西
示例-style.html
<link rel="import" href="../bower_components/polymer/polymer.html">
<!-- shared styles for all elements and index.html -->
<dom-module id="example-style"> <!-- -->
<template>
<style>
<!-- insert styles here -->
</style>
</template>
</dom-module>
网络组件-name.html
将此行添加到您的自定义 Web 组件的模板中
<style include="example-style"></style>