1
votes

Assume I want to create a component library that uses another like widget. The convention is to put the (.html|.dart) files together in /components. The Web UI page discusses importing a component - but it looks like that is in the situation where the imported component is already part of the current project.

From an html file under the /web folder, doing

<link rel="import" href="packages/widget/components/accordion.html"> 

works just fine. But, what if I want to use the accordion from a widget in my own component library - what is the way to import. For instance, say I have a stuff component library with a stuff_editor that needs to use widget's accordion. From the stuff_editor.html, the similar link fails on the build step. It seems to be looking for: "web/packages/stuff/components/packages/widget/components/accordion.html" and fails as shown:

enter image description here

1

1 Answers

2
votes

You should use the package: url prefix rather than a relative url.

<link rel="import" href="package:widget/components/accordion.html">

You can do this to include components from another library or from your own library.