postcss / postcss-custom-properties

Use Custom Properties in CSS
https://postcss.github.io/postcss-custom-properties
MIT License
595 stars 77 forks source link

Plugin is removing comments after properties. #189

Open Psoz opened 5 years ago

Psoz commented 5 years ago

I'm having an issue related to comments that are deleted when those are typed right after the property.

In my case, I need to use comments in order to use some RTLCSS features.

:root {
    --spaceM: 1.5rem;
}

.title {
      left: calc(var(--gutter-M) * -1) /*rtl:ignore*/;
      font-size:16px/*rtl:14px*/;
}

Expected Output:

.title {
      left: calc(1.5rem * -1) /*rtl:ignore*/;
      font-size:16px/*rtl:14px*/;
}

Actual Output:

.title {
      left: calc(1.5rem * -1);
      font-size:16px/*rtl:14px*/;
}

Related issue: https://github.com/postcss/postcss-custom-properties/issues/86 Related Test: https://github.com/jonathantneal/postcss-tests/tree/master/postcss-custom-properties-test-00

Thanks for your amazing work with this awesome plugin.

Thanks in advance ;)

jonathantneal commented 5 years ago

Comments are tricky business, as there is no explicit direction within the CSS specifications on how they should be meaningfully tokenized.

However, I am testing a solution that give you what you need. Hopefully, the test will be conservative enough to protect the efficiency of the plugin.