-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Comments
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. |
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)? |
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:
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. |
That's perfect, actually. If 2 links import the same file, it's only processed once, correct? |
Yes, that's correct. HTMLImports have built-in de-duping. On Fri, Feb 21, 2014 at 12:42 PM, Bobby Richter [email protected]:
|
Hooray! Thanks! |
I wrote an extensive article on using HTML Imports for dependencies, On the Polymer front, Addy wrote a great article on our Vulcanize tool: On Fri, Feb 21, 2014 at 12:55 PM, Bobby Richter [email protected]:
|
That's awesome. Thanks @ebidel! |
There's also a discussion loading import as deps in "creating elements": Closing this since there's no followup AI. |
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.The text was updated successfully, but these errors were encountered: