Skip to content

Warn on unused CSS selectors #678

@Rich-Harris

Description

@Rich-Harris

With cascade: false, we should be able to determine whether or not a CSS selector is used:

<div class='foo'>this is a div</div>
<span class='{{class}}'>this is a span with a dynamic class</span>

<style>
  /* keep these */
  * {...}
  div {...}
  .foo {...}
  .bar {...} /* we don't know the value of `class` */
  :hover {...}

  /* discard these */
  div > p {...}
  div p {...}
  p {...}
  div.bar {...}
</style>

It would be helpful to print a warning if unused selectors are encountered in a component.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions