DEV Community

Discussion on: Angular 8/9/10 + Tailwind CSS Guide

Collapse
 
seankerwin profile image
Sean Kerwin

This will only work for the style.scss at root level, the custom web pack doesn't know about the deep level component css files so you can't use the @apply method in component level stylesheets.

In fact, you shouldn't do this as a rule of thumb with Tailwind anyway. Creating your own custom utilities at root level is fine to use everywhere like a .btn class globally, but there is no need for component level utilities, just use the classes in the html. There's a really good video from Adam Watham about the best practices of Tailwind.

youtube.com/watch?v=J_7_mnFSLDg