tailwindcss-jit-cdn icon indicating copy to clipboard operation
tailwindcss-jit-cdn copied to clipboard

does @apply work?

Open jayenne opened this issue 4 years ago • 2 comments

Hi Marcel et al, I tried using @apply within a css file and it had no effect. Is @apply catered for? https://codepen.io/jayenne/pen/BaWryVG

I was specifically hoping to use it within codepen to really help my pen: https://codepen.io/jayenne/pen/GRWxgqO to display like my play.tailwindcss: https://play.tailwindcss.com/8gfgRpSQuw?file=config

jayenne avatar Jun 03 '21 12:06 jayenne

Hey,

It doesn't work with external stylesheets, but you can add an inline style tag with the type set to "postcss":


<script src="https://unpkg.com/tailwindcss-jit-cdn"></script>
<style type="postcss">
.foo {
  @apply bg-green-500 h-64 w-64 rounded-full;
}
</style>
<div class="p-16">
    <div class="foo"></div>
</div>

mpociot avatar Jun 03 '21 13:06 mpociot

Thanks very much for this Marcel, *I had tried this before posting but without the type

jayenne avatar Jun 03 '21 13:06 jayenne