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

Compiler should warn on empty style block #1138

Closed
Rich-Harris opened this issue Jan 26, 2018 · 4 comments · Fixed by #1149
Closed

Compiler should warn on empty style block #1138

Rich-Harris opened this issue Jan 26, 2018 · 4 comments · Fixed by #1149

Comments

@Rich-Harris
Copy link
Member

Small thing, but when tidying up components this would be helpful

REPL

<div class='foo'>
  no styles
</div>

<style>
  .foo {
    /* this should be warned about */	
  }
</style>
@PaulBGD
Copy link
Member

PaulBGD commented Jan 26, 2018

Maybe it should only warn when built in production? I know in development I'll leave empty blocks to fill in later, having a warning when running in development seems annoying.

@arxpoetica
Copy link
Member

arxpoetica commented Jan 29, 2018

I agree w/ @PaulBGD I can't tell you how many times I leave empty CSS selectors on purpose as a reminder to come back—so this has the potential to become noise—

—feature flag?

—production only?

—feature creep?

@Rich-Harris
Copy link
Member Author

Yeah, that makes sense actually. I'll often put selectors in just so I can tweak them in devtools.

Rich-Harris added a commit that referenced this issue Feb 7, 2018
remove empty style blocks in prod mode
@Rich-Harris
Copy link
Member Author

As of 1.54.2 empty selectors are removed in prod mode, but left alone in dev mode

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

Successfully merging a pull request may close this issue.

3 participants