Skip to content

External styles fails to load #420

Description

@tomalec

I have noticed a problem with importing external CSS styles.

According to http://www.polymer-project.org/faq.html#externalsheets, following code should work (within same domain).

GET /cssImport/elements/cssImport-foo.html:

<polymer-element name="cssImport-bar">
    <template>
        <link rel="stylesheet" href="cssImport-foo.css">

and it worked at least a week ago.
Here is an example http://tomalec.github.io/sortable-flexbox-list/tests/cssImport/

Unfortunately now (with Polymer 1.4 and Canary 34.0.1838.2) it fails with an error:

GET http://.../cssImport/elements/ 404 (Not Found) 

With current Polymer#master #93e1f4bd07 it also fails, as <link> is replaced with <style>@import but with wrong path:

<style>@import 'http://.../cssImport/elements/cssImport-bar.html';</style>

Wich results this time with:

Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://.../cssImport/elements/cssImport-bar.html".

Luckily there is workaround - write correct @import manually:

<style>@import 'http://.../cssImport/elements/cssImport-bar.css';</style>

However, behavior described above looks suspicious.

Activity

  1. ebidel commented on Feb 13, 2014

    @ebidel
    Contributor

    FYI, I've removed the bit about external stylesheets from the docs since
    we're using @import now.

    On Thu, Feb 13, 2014 at 8:19 AM, Tomek Wytrębowicz <notifications@github.com

    wrote:

    I have noticed a problem with importing external CSS styles.

    According to http://www.polymer-project.org/faq.html#externalsheets,
    following code should work (within same domain).

    GET /cssImport/elements/cssImport-foo.html:

    and it worked at least a week ago.
    Here is an example
    http://tomalec.github.io/sortable-flexbox-list/issues/cssImport/

    Unfortunately now (with Polymer 1.4 and Canary 34.0.1838.2) it fails
    with an error:

    GET http://.../cssImport/elements/ 404 (Not Found)

    With current Polymer#master #93e1f4bd07 it also fails, as is
    replaced with <style>@import but with wrong path:

    <style>@import 'http://.../cssImport/elements/cssImport-bar.html';</style>

    Wich results this time with:

    Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://.../cssImport/elements/cssImport-bar.html".

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/420
    .

  2. tomalec commented on Feb 17, 2014

    @tomalec
    ContributorAuthor

    Thanks, It works fine with Polymer 0.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions