-
Notifications
You must be signed in to change notification settings - Fork 60
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
small devx changes for css / tailwind tooling #1264
Conversation
👷 Deploy request for system-init-corp pending review.A Netlify team Owner will need to approve the deploy before you can run your build. Are you a team Owner? Visit the deploys page to approve it → Need more help? Learn more in the Netlify docs →
|
a96984e
to
24dea28
Compare
@@ -55,3 +55,19 @@ This template should help get you started developing with Vue 3 and Typescript i | |||
- Enable format on save (recommended) | |||
- add `"editor.formatOnSave": true` to `.vscode/settings.json` file | |||
- add `"[vue][typescript][javascript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" }` to `.vscode/settings.json` file | |||
|
|||
### .vscode/settings.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added full example of vscode settings file
class="appearance-none block px-3 py-2 border rounded-sm shadow-sm focus:outline-none sm:text-sm checked:bg-neutral-900 bg-neutral-600 indeterminate:bg-neutral-900" | ||
:class="checkBoxClasses" | ||
:class=" | ||
clsx( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just picked a random component with an long classes function to show an example of how clsx can help
<Icon name="minus" size="full" /> | ||
</div> | ||
|
||
<Menu> | ||
<MenuButton | ||
as="div" | ||
class="bg-white border-neutral-300 border text-black dark:bg-black dark:text-white dark:border-black text-center w-20 cursor-pointer mx-2 flex flex-col justify-center" | ||
:class=" | ||
clsx( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still helpeful, even if just breaking up lines, plus lets us quickly add more later
24dea28
to
7e7e245
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this better!
bors merge |
Build succeeded: |
1264: small devx changes for css / tailwind tooling r=theoephraim a=theoephraim did some digging into latest tooling and best practices for tailwind/css/etc. Hopefully these small quality of life improvements will help make things easier and keep things tidy. - main tool is https://github.com/lukeed/clsx - secondary is using a (noop) [string template tag function](https://www.freecodecamp.org/news/a-quick-introduction-to-tagged-template-literals-2a07fd54bc1d/) with IDE settings to get autocomplete on class lists outside of the template tag Some quick guidelines on tailwind classes: - try to keep tailwind classes in the template _as much as possible_ - feel free to use clsx even when seems unnecessary as it will make adding more classes easier later - break up super long lists of classes into multiple lines, grouping things as appropriate (ex: static classes, dark mode, toggles based on state, etc) - dont copy paste classes if used multiple times in component, move to script as static var or computed (if dynamic) and use `clsx` and `tw` helpers - its OK to also add semantic classes with BEM-ish naming if it might be helpful in debugging what html belongs to which component - we may fall back to using css occasionally where it makes sense, but it should be very rare Co-authored-by: Theo Ephraim <theo@systeminit.com>
did some digging into latest tooling and best practices for tailwind/css/etc.
Hopefully these small quality of life improvements will help make things easier and keep things tidy.
Some quick guidelines on tailwind classes:
clsx
andtw
helpers