-
Notifications
You must be signed in to change notification settings - Fork 183
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
feat: add util to write tw classes inside strings #761
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mitjans
force-pushed
the
feat/tw-util
branch
2 times, most recently
from
November 15, 2023 09:34
7d8a59e
to
b5cc8e8
Compare
Looks good to me! Happy to update the documentation to explain all this? 🙏 |
mitjans
force-pushed
the
feat/tw-util
branch
from
November 15, 2023 16:17
431e25e
to
fc5ef2a
Compare
✅ Live Preview ready!
|
mitjans
force-pushed
the
feat/tw-util
branch
from
November 15, 2023 16:38
8694958
to
399674b
Compare
@atinux added documentation for the new module option. Please, let me know if I missed anything! 🙏 |
mitjans
force-pushed
the
feat/tw-util
branch
from
November 15, 2023 16:43
399674b
to
3315a01
Compare
atinux
reviewed
Nov 16, 2023
atinux
reviewed
Nov 20, 2023
atinux
approved these changes
Nov 20, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
More often than not, there are times when you may want to write Tailwind CSS classes within TypeScript strings. For example:
When doing so, you lose intellisense in VSCode through TailwindCSS extension. To overcome this problem, the extension team created a setting to allow for custom class name completion contexts.
I thought it would be nice if this library helped the DX of TailwindCSS classes by providing a util function that when paired with the correct VSCode setting, it would automatically generate suggestions.
Approach
We can provide the following auto-imported function under the flag
addTwUtil
:We can also add in the documentation that users should add the following configuration in VSCode:
With these modifications, users of this module will now be able to write TailwindCSS classes like this:
Here's a small video showcasing the use case:
Screen.Recording.2023-11-15.at.10.23.33.mov
I feel like this could improve a lot the DX when using Tailwind CSS classes. I'm not sure if this is something you are willing to add to this module since it's very coupled to VSCode development and it requires modification of VSCode settings to work (that's why I set
addTwUtil
to befalse
by default).