Jackardios / css-to-tailwindcss

Convert CSS to TailwindCSS 3.x
MIT License
104 stars 12 forks source link

Fix margin, padding, and possibly other shorthands orders #22

Open guivr opened 1 week ago

guivr commented 1 week ago

Current Behavior

.example {
  margin: 1rem;
  margin-top: 0;
}

converts to:

.example {
  @apply mt-0 m-4;
}

(it currently puts mt-0 always before m-4, no matter the order in the CSS)

Expected Behavior

.example {
  @apply m-4 mt-0;
}

or

.example {
  @apply mt-0 mr-4 mb-4 ml-4;
}

this allows the longhand margin-top to override the shorthand margin

guivr commented 4 days ago

This is also happening with:

border: 2px solid #fff;
border-top: 3px;

seems to add border-2 at the end