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

lit-plugin complains about media queries in <style> tags #259

Open
WickyNilliams opened this issue May 16, 2022 · 2 comments
Open

lit-plugin complains about media queries in <style> tags #259

WickyNilliams opened this issue May 16, 2022 · 2 comments

Comments

@WickyNilliams
Copy link

consider a template like:

html`
  <style>
    @media (min-width: 768px) { /* (1) */
      body {
        color: red;
      } /* (2) */
    } 
  </style>
`

lit-plugin reports the following errors:

  1. { expected lit-plugin(no-invalid-css)
  2. at-rule or selector expected lit-plugin(no-invalid-css)

despite this being valid css

@ba55ie
Copy link

ba55ie commented May 19, 2022

Why aren't you using the css tagged template literal?

static styles = css`
   @media (min-width: 768px) {
      body {
        color: red;
      }
    } 
`;

https://lit.dev/docs/components/styles/

@WickyNilliams
Copy link
Author

The example given is a reduced test case for illustrative purposes only. I have experienced this issue in tests where I'm writing fixtures, and also cases where you need dynamic styles (as described here https://lit.dev/docs/components/styles/#style-element). So css doesn't cut it

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

2 participants