giscus / giscus-component

Component library for giscus, a comment system powered by GitHub Discussions.
https://giscus-component.vercel.app
MIT License
328 stars 25 forks source link

[React] Relative path to theme doesn't work #34

Closed AdisonCavani closed 2 years ago

AdisonCavani commented 2 years ago

Describe the bug I want to create a custom css for Giscus component. I created a new stylesheet in: /styles/giscus.css and I referenced it in React:

<Giscus
      [...]
      theme="/styles/giscus.css"
 />

However, the component is not styled. Console output:

Refused to apply style from 'https://giscus.app/styles/giscus.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

This means, that it's trying to get a theme from https://giscus.app, not from relative url that I passed in.

Expected behavior Component should be styled with my custom css.

Additional Context If I pass:

theme="../../styles/giscus.css"

it also doesn't work and console output is the same.

laymonage commented 2 years ago

No, this behaviour is expected. The widget is loaded within an <iframe>, so relative paths are relative to the iframe's src host, which is https://giscus.app.