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

LitElement Theme Configuration Issue #297

Closed
orindholt opened this issue Mar 8, 2022 · 5 comments
Closed

LitElement Theme Configuration Issue #297

orindholt opened this issue Mar 8, 2022 · 5 comments
Labels
✨ Feature Request Something should be added

Comments

@orindholt
Copy link

orindholt commented Mar 8, 2022

Hi!
I've been trying to implement Twind in LitElement, but having issues when trying to create a custom theme. It just won't recognize the theme's values as utilities, no matter what I do, with no error. Couldn't find a fix on stackoverflow, any idea what the problem is?

setup({
  theme: {
    extend: {
      colors: {
        purple: '#fae4fe',
      },
    },
  },
});
render() {
    return html` <h1 class="${tw`text(3xl purple)`}">${this.name}!</h1>`;
  }

Full code

@orindholt orindholt changed the title LitElement Theme Configuration LitElement Theme Configuration Issue Mar 8, 2022
@sastan
Copy link
Collaborator

sastan commented Mar 9, 2022

You are using v0.16, right? Could you give https://github.com/tw-in-js/twind/tree/next a try?

I plan to provide some examples for litelement but haven't found the time yet.

@orindholt
Copy link
Author

orindholt commented Mar 10, 2022

Thanks for your response!
I'm using twind v0.16.16 and lit v2.1.0. I tried using what you proposed, but I couldn't get it to work. Either way is properly too big a conversion on my current project. Also, it seems that setup is misbehaving in other ways.. I need to import an external stylesheet for a slider package (Splide), and It does import with:

setup({
  preflight: {
    '@import': `url('https://cdn.jsdelivr.net/npm/@splidejs/splide@3.6.12/dist/css/splide.min.css')`,
  },
});

And it appears on network with the full stylesheet. But it seems to get purged or atleast just isn't used in some way, because the styles on the classes just isn't applying to my elements. Any suggestions?
It's also worth mentioning that other options such as mode: strict works without issues.

@sastan
Copy link
Collaborator

sastan commented Mar 16, 2022

I need to take a look at this. But I'm not sure when I get to this.

@orindholt
Copy link
Author

Alrighty, no problem. Thanks for looking into it @sastan!

@sastan sastan added the ✨ Feature Request Something should be added label Oct 4, 2022
@sastan
Copy link
Collaborator

sastan commented Dec 15, 2022

This has been implemented in a new integration: @twind/with-web-components. It supports modern and legacy browsers.

You can view a preview of the docs here: https://next.twind-style.pages.dev/with-web-components. I have added a Lit example as well in case you are using that: https://next.twind-style.pages.dev/with-lit

This will be released soon (#417). Until is released you can use the pre-release version (for example @twind/with-web-components@next, @twind/core@next or @twind/preset-tailwind@next).

If you have any issues or questions please re-open this issue.

@sastan sastan closed this as completed Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature Request Something should be added
Projects
None yet
Development

No branches or pull requests

2 participants