1
我要导入我的样式表与变量中:如何导入样式表动态聚合物2.0
<dom-module id="colors-palette">
<template>
<style>
:host {
--dark-gray: #263238;
--light-gray: #e6ebed;
--light-blue: #00bcd4;
--autovision-blue: #174291;
--background-box-number-applications: red;
--color-box-number-applications: orange;
}
</style>
</template>
</dom-module>
我要动态地做到这一点。我的文件夹结构是:
-themes
-theme1
-style.html
-theme2
-style.html
-theme3
-style.html
我发现了这个主题时,我的应用程序内准备就绪之后,我试图导入我的风格像这样的准备功能:
Polymer.importHref(this.resolveUrl('../themes/' + this.getCurrentTheme() + '/colors-palette.html'));
该文件被加载,但在我-app.html风格的变种并没有改变:
app-header {
background-color: var(--dark-gray);
}
而且我得到了在控制台此错误:
中找不到命名颜色调色板
任何想法,模块式的数据?或者,也许我不得不做另外的事情?
非常感谢
完美,它的作品就像一个魅力。非常感谢你 !!! –