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

Update static styles getter to static field #34

Open
justinfagnani opened this issue Jun 29, 2022 · 1 comment
Open

Update static styles getter to static field #34

justinfagnani opened this issue Jun 29, 2022 · 1 comment

Comments

@justinfagnani
Copy link

I see some patterns like this:

  static get styles() {
    return css`
      label,
      input {
        cursor: pointer;
      }
    `;
  }

Because you're using TypeScript you can write this with standard JS field syntax:

  static get styles = css`
    label,
    input {
      cursor: pointer;
    }
  `;

It's a little nicer to read and has slightly better performance in inheritance use-cases (in Lit 2 at least).

@rowanc1
Copy link
Member

rowanc1 commented Jun 30, 2022

Super cool! Thanks for the tips, exciting to see these developments in the lit ecosystem!

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