Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

72
Views
Automatic splitting of long Tailwind strings in VSCode

I'm looking for a neat way to split this Mississippi River:

<input
  value={props.profile.get('email') ?? ''}
  placeholder="Email Address"
  className="z-10 flex-shrink-0 w-12 h-12 px-3 py-1 rounded-lg border border-gray-300 placeholder-gray-300 focus:outline-none focus:ring-[5px] focus:ring-indigo-100 focus:border focus:border-indigo-400 hover:outline-none hover:ring-[5px] hover:ring-indigo-100 hover:border hover:border-indigo-200 transform-gpu transition-all duration-50"
  onChange={e => props.updateProfile('email', e.currentTarget.value)}
/>

into something more digestible when scrolling through big repos.
Currently I'm using this approach for splitting strings:

<input
  value={props.profile.get('email') ?? ''}
  placeholder="Email Address"
  className={classNames(
    "z-10 block w-full h-12 px-3 py-1 rounded-lg border border-gray-300 placeholder-gray-300",
    "focus:outline-none focus:ring-[5px] focus:ring-indigo-100 focus:border focus:border-indigo-400",
    "hover:outline-none hover:ring-[5px] hover:ring-indigo-100 hover:border hover:border-indigo-200",
    "transform-gpu transition-all duration-50",
  )}
  onChange={e => props.updateProfile('email', e.currentTarget.value)}
/>

But there should be more convenient way, so how do you handle long rules, fellow Tailwinders?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

The only way out of this is using twin.macro, but even then the long rules will be pretty much the same.

about 4 years ago · Juan Pablo Isaza Report

0

I'd bundle these into logical groups if I were you and put them in a common file:

styles.js:

const form = 'block h-12 px-3 py-1 focus:outline-none focus: ....';
const button = 'rounded-lg border border-gray-300';

Your file then becomes:

import { form, button, input, grey } from 'styles';

...
classNames(`${form} ${button} ${input} ${grey}`)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!