2

Is there a way to exclude subfolders of a website using Stylish?

@-moz-document domain("www.website.com") { }

Will affect all pages of website.com. The problem is, this website also hosts a wiki (www.website.com/wiki/*), which has an entirely different style.
Some of the Stylish CSS affects this wiki as well, which I want to avoid.

Is there any way to do this? I've read: Disable stylish on certain sites in Firefox, but this is for a global style, which I don't have.

I should say I don't understand anything of regexp.

Community
  • 1
  • 1

1 Answers1

3

I don't know anything about coding in Stylish, but assuming you can use RegEx, you could try the following:

www.website.com(?!\/wiki\/).*

So your full code will be:

@-moz-document regexp('https?://www\\.website\\.com(?!/wiki/).*') {
  ...
}

Here is how the RegEx works:

http          # Selects HTTP protocol
s?            # Options s for HTTPS protocol
://           # :// After Protocol
www           # www
\\.           # Escaped . (dot)
website\\.com # Website
(?!           # Start of negative lookahead, If anything inside is found, the match will fail
    /wiki/        # Don't match if inside /wiki/ directory
)             # End of negative lookahead
.*            # Selects any character (.) any amount of times (*)

Live Demo on RegExr

Kaspar Lee
  • 5,446
  • 4
  • 31
  • 54