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);
}
而且我得到了在控制檯此錯誤:
中找不到命名顏色調色板
任何想法,模塊式的數據?或者,也許我不得不做另外的事情?
非常感謝
完美,它的作品就像一個魅力。非常感謝你 !!! –