List wrong transform, if comment exist after loop
AleshaOleg opened this issue · 5 comments
AleshaOleg commented
Transform will be wrong if Sass
AST have loop
type and comment
after it. Need to investigate this bug, and fix this. Example of 'Sass' string with bug:
$empty: ()
@each $el in $empty
.el-#{$el}
content: $el
$list-space: "1" "2" "3"
@each $el in $list-space
.el-#{$el}
content: $el
// comment
$list-comma: ("4", "5", "6")
@each $el in $list-comma
.el-#{$el}
content: $el
$list-2-dim: ((7 8) (9 10))
@each $el in $list-2-dim
@each $el2 in $el
.el-#{$el2}
content: $el2
sdwvit commented
It appears, that all '\n' are being teared up after loop block, thus two newliners before '$list-space: "1" "2" "3"' and '$list-2-dim: ((7 8) (9 10))' are deleted as well
sdwvit commented
will post a POC a bit later
sdwvit commented
this line magically fixes problem, but need investigation on how it happens
https://github.com/AleshaOleg/postcss-sass/blob/development/index.js#L373
AleshaOleg commented
Now it's fixed in development branch, need to make more snapshot tests, to be clear that everything working as expected.
AleshaOleg commented
Fixed for now.