Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install from URLs that end with .user.css in Stylus for Firefox(v57) (works ok in Stylus for Chrome) #258

Closed
darkred opened this issue Nov 24, 2017 · 8 comments

Comments

@darkred
Copy link

darkred commented Nov 24, 2017

First of all, I'm so glad I've found Stylus, it's so much better than Stylish!
Thanks to all for your awesome work!


Just one thing:
in the v1.1.4.3 changelog (and in documentation and #134 ), i've read that:

  1. [UserCSS mode] Stylus can install from URLs that end with .user.css or .user.styl.

Unfortunately, all .user.css files I tried in Stylus 1.1.6.1 for Firefox (GitHub/gist raw URLs),
only display the CSS code.
Example URLs I've tried:
https://raw.githubusercontent.com/Mottie/Darker-Medium/master/darker-medium.user.css
https://gist.githubusercontent.com/eight04/1b9edeb170d9f8bbabfb06dc6627f8f7/raw/foo.user.css

(In Stylus 1.1.6.1 for Chrome 62, with default settings as well, they all install ok.)

  • Browser: Firefox 57 (even in fresh profile), Stylus 1.1.6.1 with default settings
  • Operating System: win10 x64
  • Screenshot: 2017-11-24_035437
@mechalynx
Copy link

In order for Stylus to recognize that it's a .css file in the first place and actually know to parse it (as opposed to a regular text file), it has to be served with the proper mime-type. GitHub's raw display doesn't do that, on either the main site or Gist. In other words, this is a server issue but not a bug on either side.

If you want to install automatically you need to access the file through Rawgit or a similar service that serves the file with the proper mime-type (as text/css).

In the previous links, replace *.githubusercontent.com with rawgit.com and they'll work.

@darkred
Copy link
Author

darkred commented Nov 24, 2017

Thank you very much for the quick answer! So, I just installed them.

It's just strange that in Stylus for Chrome, those initial *.githubusercontent.com URLs work:
each one opens 2 tabs, one with the CSS code, and the other with the prompt page to install it.

@darkred darkred closed this as completed Nov 24, 2017
@mechalynx
Copy link

The policies behind Chrome and Firefox's behavior differ. Chrome is built in such a way that it is more aggressive in what it assumes the user wants. This works ok sometimes (like this case) and in other cases backfires and causes problems. Firefox prefers standardized behavior and consistency, which also has its ups and downs.

In any case, there is a solution that works for both in this situation and I'll be updating the wiki to make sure this is clear in the future. Thanks for using user.css!

@Mottie
Copy link
Member

Mottie commented Nov 24, 2017

When @eight04 developed the user.css installer, it was made to work with *.githubusercontent.com source files. I'm not sure why @darkred was having trouble, but both links work fine for me in Chrome for Windows 10 x64. Did you see any console errors?

Also, please check the console of the background page. Click the following link seen on the chrome://extensions/ page.

@mechalynx
Copy link

mechalynx commented Nov 24, 2017

@Mottie works in Chrome fine, just not in Firefox.

@Mottie
Copy link
Member

Mottie commented Nov 24, 2017

Ahhh derp, I guess I should learn to read... LOL

@eight04
Copy link
Collaborator

eight04 commented Nov 24, 2017

I'm pretty sure it is a CSP bug in Firefox.
greasemonkey/greasemonkey#2631

No content script can be injected into those pages.

@tophf
Copy link
Member

tophf commented Mar 12, 2018

For those who randomly found this issue: Stylus added a workaround for githubusercontent.com using a webNavigation API listener.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants