Pacane
Pacane

Reputation: 21471

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).

Upvotes: 4

Views: 252

Answers (2)

Mike
Mike

Reputation: 768

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.

Upvotes: 1

Vaibhav Mule
Vaibhav Mule

Reputation: 5126

Your path looks right ../ this is correct but go to /bower_components/paper-date-picker/paper-date-picker.html and make sure it is right.

or change that line to ../bower_components/paper-date-picker/paper-date-picker-dialog.html

and see if it works.

Upvotes: 0

Related Questions