-
Notifications
You must be signed in to change notification settings - Fork 2k
Components: Start using CSS Modules #103004
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| .wordpress-logo { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may have noticed that there's a redundant copy of this component in
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's kill it with fire! A migration is a matter of a single Cursor prompt these days. The v2 hosting dashboard eslint rules might be an exception that will need a manual hand. |
||
| .wordpressLogo { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kebab casing also works, but camel case is the official recommendation.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It's an interesting topic. It definitely feels more natural in JavaScript to reference with a camelCase property, and ultimately the class names are clobbered before they get to the client so it doesn't matter there. That said, with all the inherited experience of BEM or general kebab-case styling in CSS, I wonder if this will be an issue for people, especially in transitioning between files with different conventions. Are there ways we can make this easier, or enforce some consistency within respective file types? Thinking documentation or tooling like Stylelint rules. I also personally don't have a huge issue with referencing the kebab-case properties to keep consistency, even if it's a little less ergonomic.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No strong opinion on my end. The ergonomics/safety characteristics aren't that different once you're using an IDE extension or the ts plugin. One argument in favor of camel case is that it'll be more obvious that the file is a module, not a horrible BEM file 😂
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a pretty strong opinion to keep using kebab case, at least until it's the official recommendation of the WordPress CSS Coding Standards |
||
| fill: var(--color-text-inverted); | ||
| margin: 0 auto 20px; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,13 @@ declare module '*.svg' { | |
| } | ||
|
|
||
| declare const __i18n_text_domain__: string; | ||
|
|
||
| declare module '*.module.css' { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keeping this to only |
||
| const classes: { [ key: string ]: string }; | ||
| export default classes; | ||
| } | ||
|
|
||
| declare module '*.module.scss' { | ||
| const classes: { [ key: string ]: string }; | ||
| export default classes; | ||
| } | ||
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.
With the eventual removal of
wordpress-logo, what's the desired end-state where a component is currently overriding styles of.wordpress-logo? Would that component be expected to pass its ownclassNameto reference it in its styles?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.
Removing the hardcoded
.wordpress-logowould be a breaking change, although I'm ok with it if communicated well.Yes, that's my expectation