-
Notifications
You must be signed in to change notification settings - Fork 656
Image
GitHub introduced a Content Security Policy feature which is now causing issues when trying to include a custom background image.
Refused to load the image 'https://stylishthemes.github.io/GitHub-Dark/images/backgrounds/bg-tile1.png' because it violates the following Content Security Policy directive: "img-src 'self' data: assets-cdn.github.com identicons.github.com www.google-analytics.com collector.githubapp.com *.githubusercontent.com *.gravatar.com *.wp.com".
Sometimes, that image hosted on the gh-pages loads, most most times it does not.
Images hosted at other sites are not applied.
Here are some solutions that have been found to work
- Inline your background image
- This is great if the image is small, but please be aware that Stylish does have a size limit which this style is very quickly approaching (see contributing.md for more details).
- When using userstyles.org to update the style, select "Upload your own" background image. This automatically converts your image into a base64 encode and adds it to the style. Using this method does not appear to cause a problem with the size limitation.
-
Point to an image hosted at GitHub... it appears that only images hosted at
raw.githubusercontent.com
will work -
Point to an attached image
-
This may not be the best method to use since it's kind of cheating, but if you attach an image to an issue, it will be loaded to the GitHub cloud.
-
I attached this image and when it finished loading, it provided me with this markdown
![bg-fabric1](https://cloud.githubusercontent.com/assets/136959/4104676/3c935fd4-3194-11e4-9346-44d3fad0d65d.png)
extract out the above url and use it as your background image.
@silverwind has opened an issue to hopefully allow pointing to images hosted at github.io
so we can more easily point to gh-pages hosted images (ref).
I have contacted GitHub about this problem, hopefully we can find a solution.
GitHub Dark Wiki - © 2013-2020 StylishThemes Team