Tailwind CSS interview question · Most asked

How do you avoid repeating long class lists?

Create a free account to save this page, take notes and track your progress. Sign in

Summary

Extract components (React, Vue, Blade, partials) or loops so each pattern is written once. Use @apply sparingly for small global cases such as third-party HTML. Use @utility for custom utilities that work with variants. Avoid rebuilding a component framework with @apply.

Longer Answer

Multi-cursor editing and good class sorting help too; the official Prettier plugin sorts classes consistently.

Key Points

  • Components and loops first.
  • @apply sparingly.
  • @utility for custom utilities.
  • Prettier plugin for order.

Deep dive: Tailwind CSS Tutorial: Reusing Styles

Explanation

What interviewers look for

Prefers components over @apply.

More most-asked Tailwind CSS questions

← All Tailwind CSS questions

Was this page helpful?