Skip to content

Smarter preserve/remove [fr] #109

@PRR24

Description

@PRR24

It would be great if:

  • there was an option to preserve all non-inlineable CSS, which in addition to existing preserveMediaQueries would also preserve selectors like a:hover etc.
  • removeHtmlSelectors would cooperate with the preserved CSS, so it would remove only classes that are not addressed in preserved CSS.

For example:

<style>
.c1 { color: blue; }
.c1:hover { color: red }
.c2 { color: blue; }
@media (min-width: 100px) {
  .c2 { color: red }
}
.c3: { color: blue; }
</style>
<a class="c1">c1</a>
<a class="c2">c2</a>
<a class="c3">c3</a>

would result:

<style>
.c1:hover { color: red }
@media (min-width: 100px) {
  .c2 { color: red }
}
</style>
<a class="c1" style="color: blue;">c1</a>
<a class="c2" style="color: blue;">c2</a>
<a style="color: blue;">c3</a>

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions