Skip to content

Preserve CSS comments #54

@begriffs

Description

@begriffs

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions