stylus icon indicating copy to clipboard operation
stylus copied to clipboard

[Bug] Use element selector with comment in `@preprocessor stylus` has wrong output

Open suienzan opened this issue 3 years ago • 7 comments

Bug Report

Bug Description

Use element selector with comment in @preprocessor stylus has wrong output

Screenshots

CSS Code

/* ==UserStyle==
@name           www.google.com - 2022/7/25 17:01:40
@namespace      github.com/openstyles/stylus
@version        1.0.0
@description    A new userstyle
@author         Me
@preprocessor   stylus

==/UserStyle== */

@-moz-document domain("www.google.com") {
  body, 
  // comment
  .class {
    background: #000;
  }
}

System Information

  • OS: Linux
  • Browser: Vivaldi 5.3.2679.70
  • Stylus Version: 1.5.25

Additional Context

will compile to the following

<style id="stylus-28" type="text/css" class="stylus">
  body: ;
  .class {
    background: #000;
  }
</style>

suienzan avatar Jul 25 '22 07:07 suienzan

Using a // comment will produce incorrect result in this case even if this bug is fixed: demo.

P.S. I guess we should change the default behavior in our editor to use a /* block comment */ in stylus and less.

tophf avatar Jul 25 '22 08:07 tophf

Using a // comment will produce incorrect result in this case even if this bug is fixed: demo.

P.S. I guess we should change the default behavior in our editor to use a /* block comment */ in stylus and less.

Every line is in the same indent level. You demo has wrong indent.

suienzan avatar Jul 25 '22 08:07 suienzan

Ah, thanks. Still we should probably change the default comment type because it'll help with linting (currently we hide the internal error).

tophf avatar Jul 25 '22 08:07 tophf

It's a bug in Stylus-lang preprocessor: demo1 and demo2.

tophf avatar Jul 25 '22 08:07 tophf

Could you check if it's reported in their repo and maybe report it otherwise?

tophf avatar Jul 25 '22 08:07 tophf

Your demo links are broken when I open them. My links work. I guess it's a copypaste error.

tophf avatar Jul 25 '22 09:07 tophf

Your demo links are broken when I open them. My links work. I guess it's a copypaste error.

Fixed. Seems Vivaldi browser auto decode the url.

suienzan avatar Jul 26 '22 03:07 suienzan