Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

70
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda