Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn on unused CSS selectors #678

Closed
Rich-Harris opened this issue Jun 26, 2017 · 1 comment
Closed

Warn on unused CSS selectors #678

Rich-Harris opened this issue Jun 26, 2017 · 1 comment

Comments

@Rich-Harris
Copy link
Member

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.

@Rich-Harris
Copy link
Member Author

Implemented in 1.24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant