MohammadYounes / rtlcss

Framework for transforming Cascading Style Sheets (CSS) from Left-To-Right (LTR) to Right-To-Left (RTL)
https://rtlcss.com
MIT License
1.68k stars 129 forks source link

Some rtl-ignores being ignored and others are not #343

Closed lfloyd117 closed 1 week ago

lfloyd117 commented 1 week ago

Have a weird one here, we recently switched to using rtlcss-webpack-plugin@4.0.7 on our Ember projects with the move to Embroider (which provides a more-webpack focused build pipeline) which uses rtlcss@3.5.0 under the hood.

Now we've observed a curious case where it seems to ignore some /*!rtl:ignore*/ statements but not others. For example, here is our plain CSS output in our bundle for a specific item: image

and here it is after being processed with rtlcss-webpack-plugin: image

As you can see some of the /*!rtl:ignore*/ statements have been stripped and the values flipped which breaks our styling. But its weird to me that it happens to some but as you can see the second one is fine. Here is what the source Sass looks like:

[dir='rtl'] & {
        &:not(.is-reversed) {
            &:not(.is-toggle) {
                & > input[type='checkbox'],
                & > input[type='radio'] {
                    & + label {
                        &::before {
                            right: 0 #{'/*!rtl:ignore*/'};
                        }
                    }
                }

                & > input[type='checkbox'] {
                    & + label {
                        &::after {
                            right: 13px #{'/*!rtl:ignore*/'}; // This is the one that is not stripped but the other 2 are
                        }
                    }

                    &.mixed + label::after {
                        right: 13px #{'/*!rtl:ignore*/'};
                    }
                }
          }  
     }
}

Are we doing something wrong or is this a potential bug?

lfloyd117 commented 1 week ago

I believe this issue is coming from how our CSS is compressed, stripping important characters that mess with this.