Search code examples
dartpolymerbowerweb-component

How can I use a bower component in Dart?


I have found a nice JS component that's installed with Bower.

I'd like to know how I could import my component and let it be served by Pub.

So far I've tried to bower install it, and it gets downloaded in the root of my project in /bower_components

And then in my index.html I tried:

<link rel="import" href="../bower_components/paper-date-picker/paper-date-picker.html">

but Pub won't load the files (seems like it can't figure out relative paths in Bower).


Solution

  • By default, pub serves web as root folder, so you cant go deeper than root. The easiest way to get this to work is to symlink bower_components folder into web folder, like pub does for packages folder.

    Don't forget to remove .. before /bower_components in your href attribute after that.