Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does <link> order matter? #429

Closed
secretrobotron opened this issue Feb 21, 2014 · 9 comments
Closed

Does <link> order matter? #429

secretrobotron opened this issue Feb 21, 2014 · 9 comments

Comments

@secretrobotron
Copy link

We've been using Polymer in our app for a while before .2, and the ordering of <link>s hadn't mattered. Now, I'm seeing inheritance (extends="...") fail when link tags are out of order.

@sorvell
Copy link
Contributor

sorvell commented Feb 21, 2014

Yes, import order matters. Yes, this changed slightly recently.

Just to be clear, if x-foo is defined in x-foo.html, and x-bar extends x-foo and is defined in x-bar.html, then x-foo.html must be imported before x-bar.html.

Until recently, polymer would wait to upgrade x-bar until x-foo was available. We decided to remove this feature, but we still issue a warning on the console in this case. We removed the feature because it's only a half measure: it handles extension but not composition. Consider, for example, composition. If x-bar creates an x-zot inside its shadowRoot. In this case x-zot must also be ordered before x-bar.

@secretrobotron
Copy link
Author

Ok, excellent! Did I miss that in the docs somewhere?

We can manually order our link tags so that loading happens correctly, but is there a suggested loading mechanism that would make it easier (since we were relying on HTMLImports to do the work before)?

@sorvell
Copy link
Contributor

sorvell commented Feb 21, 2014

You'll need to do this manually, but it should be pretty straightforward and easy. The convention we're using is that an import defines a custom element. That import would then import any other element imports that it needs. This what you only have to ever consider the imports needed for a given element. For example, xbar.html:

<link rel="import" href="../components/x-foo/x-foo.html">
<polymer-element name="x-bar" extends="x-bar">
  ...
</polymer-element>

We also have a tool called vulcanize (https://github.com/Polymer/vulcanize) that creates builds of imports.

@ebidel Is this doc'd and if not, can we be sure to add it? Thanks.

@secretrobotron
Copy link
Author

That's perfect, actually. If 2 links import the same file, it's only processed once, correct?

@sorvell
Copy link
Contributor

sorvell commented Feb 21, 2014

Yes, that's correct. HTMLImports have built-in de-duping.

On Fri, Feb 21, 2014 at 12:42 PM, Bobby Richter [email protected]:

That's perfect, actually. If 2 links import the same file, it's only
processed once, correct?


Reply to this email directly or view it on GitHubhttps://github.com//issues/429#issuecomment-35771369
.

@secretrobotron
Copy link
Author

Hooray! Thanks!

@ebidel
Copy link
Contributor

ebidel commented Feb 21, 2014

I wrote an extensive article on using HTML Imports for dependencies,
performance, and de-duping:
http://www.html5rocks.com/en/tutorials/webcomponents/imports/

On the Polymer front, Addy wrote a great article on our Vulcanize tool:
http://www.polymer-project.org/articles/concatenating-web-components.html

On Fri, Feb 21, 2014 at 12:55 PM, Bobby Richter [email protected]:

Hooray! Thanks!

Reply to this email directly or view it on GitHubhttps://github.com//issues/429#issuecomment-35772584
.

@sorvell
Copy link
Contributor

sorvell commented Feb 21, 2014

That's awesome. Thanks @ebidel!

@ebidel
Copy link
Contributor

ebidel commented Mar 16, 2014

There's also a discussion loading import as deps in "creating elements":
http://www.polymer-project.org/docs/start/creatingelements.html#reuse

Closing this since there's no followup AI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants