Conversation
17e989c to
d4cdadd
Compare
b5cf6f1 to
712f6fe
Compare
2c97d4b to
5b8b718
Compare
5b8b718 to
d377138
Compare
712f6fe to
4198e59
Compare
|
@purfectliterature Please rebase thanks! |
d377138 to
e2d419a
Compare
|
I found that I committed a fix 732883d that allows |
ekowidianto
left a comment
There was a problem hiding this comment.
Great job @purfectliterature!! Thanks for introducing this framework. I like it just because TLDR - ‘Tailwind is a constrained inline style that allows responsive design and hover, focus and other states styling’.
A few things to note:
- Do we want to consider using this plugin to optimize prod build? Probably this wont help much now but I guess this is good for future development. https://tailwindcss.com/docs/optimizing-for-production
- Could you help adding some docs on the usage for react styling in ‘Readme.md’ in the ‘client’ folder? We will need to start populating this file with more convention, guideline and usage info for our project (eg redux, intl, router, testing, etc).
- Please add linter/eslint.
- In the future, should we use tailwind theme or preset to centralize styling, theme ,color ,etc control and how/if do we reconcile with MUI?
732883d to
18681ec
Compare
I have since set up
I will add the documentations after I spend some time with them when I migrate the Course Settings page. I have added an issue #5067 for me to track.
Tailwind has linting built into their Tailwind CSS IntelliSense extension for Visual Studio Code. This extension includes both linting and IntelliSense for their utilities, as well as the raw CSS outputs to see the actual
Yes, we should centralise everything in Tailwind, more specifically Text systems and colours can be a bit iffy, because we'd probably still want to be able to access these via MUI's props, e.g., I did not set this up in this PR because (a) it could affect font/colour styles in many, many pages, and (b) our transition to Tailwind is still under probation anyway. Let me fully test-drive Tailwind in my Course Settings migration first, then once everything is okay and there is no gotchas, I will set up the remaining bits and pieces of MUI x Tailwind; we can merge this PR in first. |
18681ec to
8780a4c
Compare
Great thanks! |
Note: This PR hasphillmont/new-edit-assessment(#5034) as a base branch.Transition to
Tailwind CSS is a utility-first CSS framework for rapidly building custom user interfaces. It offers a different paradigm of traditionally writing 'semantic' CSS, allowing for definitive stylesheet consistency, ease of configuration, and better developer experience. Read how Adam Wathan, the creator of Tailwind CSS, convinced the world that utility-first CSS is a thing, and brought Tailwind CSS to one of the best and most popular CSS frameworks.
TL;DR
sxorstyleprops/attributes being used.styled-components, or Emotion are henceforth illegal.If you really have to, refrain from using absolute values. Use
rem, notem.componentProps,InputLabelProps,InputComponentProps, etc., to provide Tailwind'sclassNames. This is MUI's official recommendation, anyway.Unless really necessary, do NOT directly target MUI's class names, e.g.,
.MuiDialog-root, because ideally, these are MUI's internal implementation details that might change in their next versions.Things to note when developing with Tailwind for now
The Tailwind's stock utilities are provided in
index.css. This is also where you will put your custom utilities, if really needed. It must be loaded by the root React instance, ideally the one who callsReactDOM.render. Since our SPA is upcoming,index.cssis loaded byclient/app/index.js.The default React
#rootelement is self-assigned incourse.html.slim. If other modules need Tailwind utilities, append the#rootID to the parent HTML element.If your Tailwind utilities do not work on any
Portalelements, set theircontainerto therootElement(likeDialog,Popover, andPopperhere) so they are mounted there instead ofdocument.body.Some metric, if you care
As of this PR, with only some components' styles converted to Tailwind's utilities (see Files changed), their bundle sizes reduced by 3-5%, analyzed with Bateman's Webpack Visualizer. As more styles are moved to Tailwind, our bundle sizes should reduce, but only by a tad bit.
Notably, performance or bundle size is not the point of this transition. It is all about the developers' experience and writing stylesheets that are scalable and do not grow (sharply) as our React code grows.