css-ratiocinator
css-ratiocinator copied to clipboard
Preserve CSS comments
As mentioned in #52, ratiocinator strips all comments. One challenge in preserving them is that selectors are often removed or changed in the output, so comments for individual styles need to be rearranged in the output.
One possible algorithm:
- For each comment, find its closest selector
- Add a fake CSS property there, like
_commentwhose value is the text of the comment - Run the ratiocinator algorithm
- When outputting the resulting styles, look for the
_commentproperty, remove it, and print it as a comment above the style block
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.