addyosmani / prism-js

A Polymer element for syntax highlighting with Prism.js
149 stars 15 forks source link

prism-js attempts to load polymer #7

Closed MichielDeMey closed 10 years ago

MichielDeMey commented 10 years ago

Hi

I noticed that this webcomponent attempts to load polymer. https://github.com/addyosmani/prism-js/blob/gh-pages/prism-js.html#L2

But I already have a project with multiple webcomponents, resulting in an error Possible attempt to load Polymer twice

Do we want to load polymer inside the webcomponent? Or should we load it in the application, rather then per component?

yeehaa123 commented 10 years ago

I have the same problem...

GoceRibeski commented 10 years ago

Polymer should be loaded inside the web component, and it is not a problem until every component loads it from the same URL - cause browser de-dupes all requests from the same URL: http://www.html5rocks.com/en/tutorials/webcomponents/imports/

Check the source and make sure each component is loading polymer.js from the same URL.

MichielDeMey commented 10 years ago

Got it, but how do we ensure that all webcomponents load Polymer from the same URL?

If you use something like Bower, you're not in control of other developer's web components.

This is probably a big issue, but not something that can be addressed easily.

addyosmani commented 10 years ago

Please note that the version of this element in master has now been rewritten. Per all of the elements we write on the Polymer team, Polymer itself is loaded as an import. At your index/top-root level, you should only have to load in platform.js and your imports themselves polymer.html should they require it. We handle deduping that resource otherwise.