Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support class tag while using a JS string #101

Closed
deadcoder0904 opened this issue Nov 28, 2020 · 3 comments
Closed

Support class tag while using a JS string #101

deadcoder0904 opened this issue Nov 28, 2020 · 3 comments

Comments

@deadcoder0904
Copy link

deadcoder0904 commented Nov 28, 2020

Is your feature request related to a problem? Please describe.
I'm using Remark to style a table in Tailwind. I can't style it directly as my table is in markdown so I have to use Remark as an intermediary step to do it.

I have an array which contains table tag & I keep pushing tr, th, etc... onto it like:

const str = []
str.push(`<table class="table-fixed max-w-7xl full-bleed md:mx-12 divide-y divide-gray-200">`)
str.push(`<thead class="">`)
str.push(`<tr class="">`)
str.push(`<th class="px-6 py-3 bg-gray-50 text-left text-2xl font-semibold text-blue-gray-700 tracking-wider">${k}</th>`)

Describe the solution you'd like
I'd love for Headwind to sort classes in JS files too where a string uses class tag.

@petertriho
Copy link
Contributor

petertriho commented Feb 21, 2021

@deadcoder0904 this can be done by adding this to your settings.json

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

@deadcoder0904
Copy link
Author

Good to know :)

@petertriho
Copy link
Contributor

Fixed in #109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants