loading...

re: Building my site with Tailwind CSS VIEW POST

FULL DISCUSSION
 

Great Read ! You mention "Repeating CSS" and " ... One of the biggest annoyance of utility-first is the repeated classes ... ". That got me thinking, have you tried using the @apply feature from tailwind ?
tailwindcss.com/docs/extracting-co...

Haven't tried tailwind myself yet, but once I read the docs, I really liked the @apply feature and I can't wait to try it :)

I think you could do

<h1 class="blue-heading">Tibit Title</h1>

.blue-heading {
   @apply bold text-2x text-blue
}

like "grouping" talwind classes

 

Thanks for reading my article and the positive feedback Pascal 😄

Unfortunately @apply didn't work for me. I'm using stylus with VuePress. Something about the syntax that's not working 😖 But I have used their theme() function and it works perfectly 👍

h1 {
  font-weight: theme('fontWeight.semibold')
}

I'm terrible at naming things, it's one of the reasons I love about Tailwind -- No more class or id names. Instead, I just apply the style directly...and with that comes the benefits of speed and moving very quickly without thinking of class names 😆

Can't wait until you give Tailwind a try! I'm a huge fan 👏

 

@samanthaming , does the @apply statement work if you try specifying the language with the "lang" attribute? I've never tried multiple style blocks in a vue component, so I'm interested to know if this works:

<style lang="css" scoped>
/* Your tailwind css here */
/* Does @apply work here? */
</style>

<style lang="stylus" scoped>
/* Your stylus here (that you already have) */
</style>
 

I am wondering if the theme () option is helpful when trying to create a darkmode/lightmode feature for a webapp 🤔🤔

Code of Conduct Report abuse