HTML5 Web Components with Polymer - loading external Stylesheets in template

106 views
Skip to first unread message

gbesch...@gmail.com

unread,
Mar 12, 2014, 12:40:00 PM3/12/14
to polym...@googlegroups.com

Heyo, i've got a problem using a <link rel="stylesheet" src="test.css" /> in a <template></template> in my custom polymer-element. I've imported and loaded everything relevant to use polymer. The error i get when trying to load external stylesheets is the following:

Uncaught TypeError: Cannot call method 'cacheStyles' of undefined styles.js:38

This error occurs when i try to load a stylesheet like follows:

- @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" />

All of the above methods of loading an external stylesheet fails with the mentioned error. Does someone have any suggestion i can still try out?

PS: It works when i hardcode it into the custom element but i'd like to add more than 500 lines of css for the element because it's a multilevel push menu i'm developing

Cheers, Gbeschbacher

Daniel Freedman

unread,
Mar 12, 2014, 2:13:06 PM3/12/14
to polym...@googlegroups.com, gbesch...@gmail.com
I answered your post on StackOverflow here: http://stackoverflow.com/a/22360277/3303267

Please don't cross post, it gets hard to keep track of incoming questions :)
Reply all
Reply to author
Forward
0 new messages