Skip to content

fix(ui-components): correct the setup of tailwind default styles - #45369

Merged
ahmaxed merged 1 commit into
freeCodeCamp:mainfrom
huyenltnguyen:fix/tailwind-styles
Mar 15, 2022
Merged

ahmaxed merged 1 commit into
freeCodeCamp:mainfrom
huyenltnguyen:fix/tailwind-styles

Conversation

@huyenltnguyen

@huyenltnguyen huyenltnguyen commented Mar 7, 2022 •

Copy link
Copy Markdown
Member

Checklist:

  • I have read freeCodeCamp's contribution guidelines.
  • My pull request has a descriptive title (not a vague title like Update index.md)
  • My pull request targets the main branch of freeCodeCamp.
  • I have tested these changes either locally on my machine, or GitPod.

I realized that I setup a Tailwind config wrong.

Tailwind provides us 3 default stylesheets: base, components, and utilities. They should be grouped in a single file, which I already did, and the file is global.css, but I'm currently importing it to the stylesheet of each component in the ui-components library.

/* button.css */
@import './global.css';

.otherStyles {}

While I believe the correct setup should be having that single stylesheet minified and included in the library bundle instead. Then it is the responsibility of the consumer apps to import that stylesheet as well in. Something like this:

// index.tsx - The root index file of /learn

import '@ui-components/dist/global.css'

This PR updates the setup and I'm also renaming the global.css file to base.css as I think it is more appropriate.

References:

@gitpod-io

gitpod-io Bot commented Mar 7, 2022

Copy link
Copy Markdown

@github-actions github-actions Bot added the scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. label Mar 7, 2022
@ghost

ghost commented Mar 7, 2022 •

Copy link
Copy Markdown

👀 Review this PR in a CodeSee Review Map

Preview the Review Map

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

Comment thread tools/ui-components/src/global.css Resolved
@huyenltnguyen
huyenltnguyen marked this pull request as ready for review March 7, 2022 10:53
@huyenltnguyen
huyenltnguyen requested a review from a team March 7, 2022 10:53

@moT01 moT01 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@moT01 moT01 added the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Mar 10, 2022
@ahmaxed
ahmaxed merged commit 610ba7b into freeCodeCamp:main Mar 15, 2022
@huyenltnguyen
huyenltnguyen deleted the fix/tailwind-styles branch March 20, 2022 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants