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

STRWEB-111 Refresh PostCSS stack. #142

Merged
merged 4 commits into from
Apr 22, 2024
Merged

STRWEB-111 Refresh PostCSS stack. #142

merged 4 commits into from
Apr 22, 2024

Conversation

JohnC-80
Copy link
Contributor

@JohnC-80 JohnC-80 commented Apr 10, 2024

Pre-empting a tighter build process with pre-transpilations, we want to ensure purity in our CSS so that we reduce the amount of discrepency between builds performed at separate locations in the code, in separate repos, etc.

This PR removes unnecessary postcss plugins that have already been implemented in native CSS. This includes:

  • postcssCalc - mainly used for calc-ing custom properties.
  • postCSSColorFunction (hooray! a dependency we had to fork a while back. Death to forks! 🥢 )
  • postCSSCustomProperties (CSS variables)
  • postCSSMediaMinMax (Media Query ranges)
  • postCSSNesting (All those fun little &'s in our styles)

Additionally, this PR respects standard CSS Variable treatment - render once, use throughout codebase. Imports of CSS variables from stripes-components have been filtered out, and the global set are injected via a additional entry point (alongside global.css in the base webpack configuration.)

I've added on a single postcss-dependency: postcss-global-data for usage in conjunction with postcss-custom-media. Stripes' CSS variables and custom media variables existed within the same file. UI modules would need to import the file because of the custom media variables. However, if variables are injected via postcss-global-data ui-modules will no longer have to import the variables for them to be used.

All modules and components can remove imports to variables.css from stripes-components.

With this standard treatment of CSS variables, the gates are also open for a clean implementation of theming...

Copy link

github-actions bot commented Apr 10, 2024

Jest Unit Test Statistics

0 tests  ±0   0 ✔️ ±0   0s ⏱️ ±0s
0 suites ±0   0 💤 ±0 
0 files   ±0   0 ±0 

Results for commit 8e9d6f9. ± Comparison against base commit 93362cb.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Apr 10, 2024

BigTest Unit Test Statistics

73 tests  ±0   73 ✔️ ±0   0s ⏱️ ±0s
39 suites ±0     0 💤 ±0 
  1 files   ±0     0 ±0 

Results for commit 8e9d6f9. ± Comparison against base commit 93362cb.

♻️ This comment has been updated with latest results.

@JohnC-80 JohnC-80 marked this pull request as draft April 11, 2024 12:57
@JohnC-80 JohnC-80 marked this pull request as ready for review April 11, 2024 17:04
@JohnC-80 JohnC-80 requested review from zburke and mkuklis April 15, 2024 14:50
Copy link
Contributor

@mkuklis mkuklis left a comment

Choose a reason for hiding this comment

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

❤️

Copy link
Member

@zburke zburke left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

strip out imports of variables to prevent variable reset via a custom postcss plugin.

This seems like a great idea. Also seems like maaaybe a change in behavior that we need to tell people about? Or is it more like, "Finally prevent people from doing things they shouldn't have been doing in the first place" so we don't need to worry about telling anybody?

@JohnC-80
Copy link
Contributor Author

@zburke yes - this is something worth telling folks - that they can just strip out their imports since now both variables and custom media queries are accounted for. I will roll a stripes-update message.

@JohnC-80 JohnC-80 merged commit abc5405 into master Apr 22, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

3 participants