css-ratiocinator icon indicating copy to clipboard operation
css-ratiocinator copied to clipboard

Preserve CSS comments

Open begriffs opened this issue 11 years ago • 0 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 _comment whose value is the text of the comment
  • Run the ratiocinator algorithm
  • When outputting the resulting styles, look for the _comment property, 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.

begriffs avatar Dec 20 '13 21:12 begriffs