Closed paponius closed 9 months ago
I can save your example without errors, but judging by your description you might have misunderstood what selector-exists
does. It doesn't check if a selector exists in the page, but only in your own style.
but only in your own style.
I was afraid of that might be the case.
But still, it should at least save and give bad result. I just simplified the sample too much, maybe there needs to be another stylus lang construct so the stylus is applied?
Try this:
/* ...
@preprocessor stylus
... */
@-moz-document domain("example.com") {
body {
testA: selector-exists('div');
testB: selector-exists('div') ? a : b;
testC: typeof(#fff);
color: lighten(#2c2c2c, 50);
}
.test {
display: none unless true;
}
}
The same happens in the official demo, so it's either a bug or a feature of the preprocessor. See this article for workarounds.
Their 7 years old bug. https://github.com/stylus/stylus/issues/2345 I did try it in their Playground, but only the partial code, which worked. The function only works, when it's the last in a code. Sorry I did not investigate more thoroughly.
feature request: simple preprocessor, which does not try to "simplify" CSS into a mess no one can read, including the preprocessor itself, and cook a coffee meantime.
Some built-in functions are either not supported, maybe because of an old stylus.min.js
or are not processed correctly in Stylus,
or I am doing something wrong.
e.g. function:
selector-exists()
https://stylus-lang.com/docs/bifs.html#selector-exists-selectorSimplified example: testC and color are using working stylus-lang Built-in functions. The result is as expected.
testA, testB would not allow the Style script to be saved. Showing an error.
full use-case with what I tried and wanted to do:
https://userstyles.world/style/14653/deannoy-dailymail-papo
should resolve TRUE on https://www.dailymail.co.uk/home/index.html
and FALSE on https://www.dailymail.co.uk/video/...