Last Updated: February 25, 2016
· iaincampbell

External CSS in Polymer Dart

So, an upgrade to Polymer and now my app has been teasing me with missing styles.

For future reference, having this within a polymer element:

<link rel="stylesheet" href="/path/to/styles.css">

works at random. Which is disconcerting to begin with, to say the least.

The solution is straightforward (in retrospect, as is always the way) and just requires that you import the styles instead of linking to them:

@import "../../path/to/styles.css;

Simply edit all 40+ of the template files in your app and you're good to go again.

I haven't checked all of the release notes yet so I can't tell whether this is either:

  1. a change from a previous version
  2. down to my app reaching a certain level of complexity

With that in mind, YMMV.