2014-03-12 58 views
0

Heyo,我在使用<link rel="stylesheet" src="test.css" /><template></template>中導入了我自定義的聚合物元素。我已經導入並加載了與使用聚合物相關的所有內容試圖加載外部的樣式表時,我得到的錯誤是:HTML5 Web Components with Polymer - 在模板中加載外部樣式表

遺漏的類型錯誤:無法調用「cacheStyles」未定義styles.js的:38

當我嘗試加載樣式表時出現此錯誤像如下:

- @import "test.css"; 
- @import url(test.css); 
- @import url("test.css"); 
- @import url("http://localhost/misc/test.css"); 
- @import url(http://localhost/misc/test.css); 
- @import "http://localhost/misc/test.css"; 
- <link rel="stylesheet" src="http://localhost/misc/test.css" /> 
- <link rel="stylesheet" src="test.css" /> 

所有加載外部的樣式表的上述方法失敗,並提到的錯誤。有人有任何建議我仍然可以嘗試嗎?

PS:它的工作原理,當我硬編碼到自定義元素,但我想添加500線以上的CSS爲元素,因爲它是一個多層次的推菜單我開發

乾杯,Gbeschbacher

回答

2

這聽起來與https://github.com/Polymer/polymer/issues/441相同。

不幸的是,bower 0.2.1發行版錯誤地指出了使用聚合物/平臺0.1.4而不是0.2.1,其中有cacheStyles API更改。

我修復了不正確的bower依賴關係,但我不得不修改版本標記,任何嘗試在兩者之間進行更新的人都會得到一個錯誤的副本。

解決方法是再次刪除bower_components,運行bower cache clean,然後再運行bower install

對不起,我感到困惑。

+0

感謝您的回答!我在其他地方發佈了這個問題(github文檔問題,谷歌組等) - 我將更新這些帖子併發布此鏈接作爲答案!)PS:看到你已經做到了 - 非常感謝! – Gbeschbacher