userscripts icon indicating copy to clipboard operation
userscripts copied to clipboard

Feature Request: Add full support for UserCSS spec set by OpenStyles

Open Reinachan opened this issue 3 years ago • 3 comments

Motivation

Stylus is currently the leading extension for userstyles, meaning userstyle writers tend to follow the conventions set by Stylus. However OpenStyles is not interested in porting or hosting Stylus on iOS. There's only a single extension currently (to my knowledge) that supports the full featureset of Stylus but it's slow, bloated, and privacy-invasive. It would therefore be great if this extension would support the full spec as most userstyles hosted on various sites today does not work at all.

UserCSS spec

Missing functionality

  • [ ] @moz-document url()/domain()/url-prefix()/regexp() This is an alternative way of declaring what urls to match for rather than placing it in the metadata. This approach lets userstyles target specific areas of a website only with styling which is especially useful for websites that have inconsistent frontends. I've used this previously when a website hosted their documentation using a separate method from their primary site, meaning the DOM was different.

  • [ ] CSS Preprocessors

    • [ ] default - standard CSS
    • [ ] stylus - stylus-lang documentation These allow the usage of CSS preprocessors which simplify the workflow of writing CSS and changes how @var is implemented
  • [ ] @var variables defined in metadata This allows users to adjust styles to their liking using simple ways of choosing values for the style. This is not as important as the above two but not supporting it will possibly break support for some userstyles.


I'd help out with this myself but my Macbook is old and I'm not sure I'll actually be able to.

Reinachan avatar Jan 20 '22 17:01 Reinachan

@Reinachan thank you for the very thoughtful and well organized feature suggestion(s).

To be completely transparent, I am not very keen on adding these features to Userscripts. My feelings on this could change, but this is how I feel right now. I will attempt to explain why I feel this way below.

  1. My main goal for this project is that it matures into a fully developed userscript manager for Safari. Currently, I have no other desires for this project outside of that. I've not yet fulfilled that goal, although I feel it is close. There's some key API methods missing, performance updates that need to go in, an entire refactor update needed and many ui/ux enhancements required. All of my time spent working on this project will be spent doing that.

  2. For a while now I've wanted to drop support for "CSS userscripts". I originally implemented them for my own quality of life stylesheets that I made for random websites, but now that there's a handful of API methods, I find GM.addStyle reduces the need for "CSS userscripts" (or at least the type that is implemented in this app). This app never really had full support for UserStyles and I feel it mostly serves to confuse users. It uses the the UserStyle type of metadata but doesn't support any of the other aspects of a UserStyle you mention above. A near future version of this app could see the elimination of the "CSS userscripts" and I don't think I would want to dive deeper into stylesheets after refocusing entirely back to "JS userscripts".

  3. As you've mentioned Stylus is the leader for userstyles. They are the ones who should be building this extensions. I've not ever used Stylus and the only UserStyles I've ever made were the ones in this app, which as mentioned before, are really "half-baked" UserStyles. If such features were to be implemented I'd not only have to develop the code to run them, but prior to doing so I'd have to actually figure out a lot about how they are used and gain a strong understanding for what Stylus is, how UserStyles work and all that goes along with that. All for something I feel diverged from the goals I have for the project.

That all being said, these are feelings right now. They could change when I hit the aforementioned goals. I write this not to stomp on your suggestion but to be transparent and to set expectations.

quoid avatar Jan 21 '22 03:01 quoid

I can understand your decisions but I do hope that you don't entirely remove it. I'm fixing up my GitHub action so that I can create another version of my userstyle that targets this extension. The reason being that, well, Stylus won't port for iOS because they don't want to pay the Apple tax and don't feel like taking money for it (I can't seem to find the issue where this was mentioned anymore so take it with a grain of salt).

I did a manual conversion to work with Userscripts after compiling to standard CSS and this extension just loads userstyles and userscripts pretty much immediately which is really nice tbh. The alternative, Hyperweb, is as I mentioned above quite slow and privacy-invasive. Actually, so slow that it often takes a full second or two after the page is loaded before the style and/or userscript is loaded!

I'd much prefer if you partially deprecate userstyles than completely remove it. Though, I also hope you change your mind on this. In the case I'm able to contribute code for this, would you be more willing to support it? I can see if I can get this working on my Mac and give it a try.

Reinachan avatar Jan 21 '22 10:01 Reinachan

@Reinachan Nothing is going to happen immediately.

so that I can create another version of my userstyle that targets this extension.

If you're planning on rewriting your UserStyles, you might want to consider rewriting them in a normal userscript format using GM.addStyles. With this app the difference isn't that great between the two formats, but obviously it is your decision.

I'd much prefer if you partially deprecate userstyles than completely remove it.

There's a possibility that is how it turns out. I really don't know yet.

In the case I'm able to contribute code for this, would you be more willing to support it?

Honestly, I wouldn't be interested in PRs for UserStyle support at the current time. I'd much prefer contributions for the issues labeled Help Wanted. However, I do appreciate the offer. If things change in the future, I would most certainly want the help.

quoid avatar Jan 21 '22 13:01 quoid