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

A question about using with tailwind #65

Open
lana-k opened this issue Feb 26, 2023 · 1 comment
Open

A question about using with tailwind #65

lana-k opened this issue Feb 26, 2023 · 1 comment

Comments

@lana-k
Copy link

lana-k commented Feb 26, 2023

Hi, I have a couple of questions about using pinceau with tailwind (if it's possible):

  • can I use design tokens from tailwind (tailwind.config.js) instead of tokens.config.ts?
  • how can I use pinceau with @apply?

Generally, I like the idea to move logic related to styling out from script tag, but I can't figure out how to use it in a project with tailwind. How can I rewrite this using pinceau?

<template>
    <button :class="buttonClass">Example</button>
</template

<script>
...
computed () {
    buttonClass () {
       return this.isPrimary ? `primary` : `secondary`
     }
}
...
</script>

<style scoped>
.primary {
  @apply bg-red-500;
}

.secondary {
  @apply bg-slate-500;
}
</style>

In other words, how can I move logic to style and have one dynamic class? Something like this?:

<style scoped>
css({
  '.btn' {
    '@apply':  ({props}) => props.isPrimary ? 'bg-red-500' : 'bg-slate-500';
  }
})
</style>

@SGAMERyu
Copy link
Contributor

SGAMERyu commented Feb 28, 2023

The Variants System section in the Pinceau documentation should be able to answer your question. https://pinceau.dev/styling/variants

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