stylus-supremacy
stylus-supremacy copied to clipboard
Comments and empty lines inside object definitions cause harrowing comment weirdness
namespace = {
one: 1,
// A comment (or empty line) inside an object definition triggers weirdness
two: 2,
}
becomes this:
// A comment (or empty line) inside an object definition triggers weirdness
namespace = {
one: 1,
two: 2,
}
But there's more! 😀
If I remove the comment but leave an empty line:
namespace = {
one: 1,
two: 2,
}
mixin() {
// Comment A
// Comment B
some: style;
// Comment C
// Comment D
}
selector {
// Comment E
// Comment F
some: style;
// Comment G
// Comment H
}
Then this happens:
namespace = {
one: 1,
two: 2
};
mixin() {
// Comment A
some: style;
} // Comment D
selector {
// Comment E
some: style;
}
I'm terribly busy this week. Please spare me sometime to fix this. I suspect that this bug has just been introduced in the recent release.
I've noticed as well if I have comments at the end of the file, they'll get removed completely.
Using command line with selectorSeparator=\n
comments at the end of the file are removed:
div
border 0
// some comment
comments near selectors get removed also
#id
.class // hello there
span
border 0
weird also with @media and if/else
@media screen // first comment
if a
border 0
else // second comment
border 20
gives
@media screen
if a
border 0
else
border 20 // first comment
Comments near if get moved below
if a //comment
border 0
gives
if a
border 0 //comment
keep comment marker gets removed
/*!
* Some licence
*/
gets transformed to
/*
* Some licence
*/
notice the !
that disappeared.
Removal of comments in the middle of a file are also a problem
.someClass
// todo implement this later
.anotherClass
border 0
transforms to
.someClass
.anotherClass
border 0
which generates a completely different css
I'll try adding tests in a MR
testing @maranomynet example, adding empty lines changes the response until 11 empty lines when no more comments can be seen O_o
However adding a comment in the middle does not move it up anymore, now it simply disappears