heybourn / headwind

An opinionated Tailwind CSS class sorter built for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=heybourn.headwind
MIT License
1.39k stars 44 forks source link

Sort classes inside functions #201

Open CEN-Smart opened 1 year ago

CEN-Smart commented 1 year ago

Sort classes inside functions How can we sort classes in a conditional class function.

import classNames from 'classnames'

  <h1 className={classNames(`grid place-items-center min-h-screen`)}>Coming Soon...</h1>
Mheaus commented 1 year ago

This kinda works in headwings settings :

"headwind.classRegex": {
   ...
  "typescriptreact": "(?:\\bclassName\\s*=\\s*[\\\"\\']([_a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\'])|(?:\\btw\\s*`([_a-zA-Z0-9\\s\\-\\:\\/]*)`)|(?:\\bclassName\\s*=\\s*(?:[^\\'\\\"\\}]+[\\'\\\"]([_a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\'])*)"
}