Standardize scss import practices#9183
Conversation
brad-decker
commented
Aug 11, 2020
- Rename the base 'index' scss files to be more descriptive
- separates ui/app component imports into their own files
- moves imports to their proper new location
- Alphabetizes imports in root files.
6f7c79c to
64199a4
Compare
64199a4 to
7cdf7f7
Compare
Builds ready [7cdf7f7]
Page Load Metrics (586 ± 51 ms)
|
|
@tmashuang thank you for finding those! I'll go through and review why the import order caused this to break as it likely means we are relying on styles from unrelated files which most likely is causing more heartaches than fixing things. |
|
@tmashuang - we can avoid .some-class {
.child {
font-size: 16px;
}
}compiles to .some-class .child {
font-size: 16px;
}whereas .some-class {
&__child {
font-size: 16px;
}
}compiles to .some-class__child {
font-size: 16px;
}In some cases here I am adding an additional ampersand to get the nested effect .some-class {
& &__child {
font-size: 16px;
}
}compiles to .some-class .some-class__child {
font-size: 16px;
}as we would hope. |
|
I added a commit that resolves those specific issues. I'm looking through the extension now to see if i can find anymore. I did end up pulling out the mixins created ad-hoc in the buttons scss file and converted everywhere they were being used to consume the button component instead. These will likely need to be reviewed carefully for breaking changes |
There was a problem hiding this comment.
Good find, I fixed this issue for the choose recipients view on the send page, but missed it here. I'll apply the same fix there and get a revision up for you.
Builds ready [c3cfd91]
Page Load Metrics (568 ± 50 ms)
|
1198e1f to
70812b1
Compare
1. Rename the base 'index' scss files to be more descriptive 2. separates ui/app component imports into their own files 3. moves imports to their proper new location 4. Alphabetizes imports in root files.
70812b1 to
cb449bb
Compare
cb449bb to
e864ce6
Compare
Builds ready [e864ce6]
Page Load Metrics (355 ± 49 ms)
|
|
Ready for another look @tmashuang. Thank you 🙏 |
|
As it turns out, not nesting CSS seems to be the philosophy of BEM. I can achieve the same specificity by changing |
ui/app/pages/pages.scss
Outdated
| @import 'send/send'; | ||
| @import 'settings/index'; | ||
| @import 'token/index'; | ||
| @import 'create-account/index'; |
There was a problem hiding this comment.
| @import 'create-account/index'; | |
| @import 'create-account/index'; | |
| @import 'unlock-page/index;' |
There was a problem hiding this comment.
whoops, rebase error. Thanks
There was a problem hiding this comment.
Fixed, and put in the proper order.
| </Button> | ||
| </div> | ||
| </div> | ||
| ) |
Builds ready [cc17b9a]
Page Load Metrics (439 ± 61 ms)
|
* origin/develop: (137 commits) Use @metamask/eslint-config@3.1.0 (#9275) Standardize scss import practices (#9183) Update ESLint shared config to v3 (#9274) Add lock icon to default networks (#9269) Adds toPrecisionWithoutTrailingZeros utility (#9270) Hide gas estimate on non-main network (#9189) Move the mascot component to its own directory (#9272) Use @metamask/controllers@2.0.5 (#9266) Fix padding, alignment of actionable-message; add left aligned story Code cleanup and simplification for actionable-message component Adds actionable message component and stories Fix lint issues (#9265) Fix prefer-destructuring issues (#9263) colocate confirm-decrypt-message page styles (#9252) Tidy up Migrator tests (#9264) Adds pulse loader component (#9259) Fix import/order issues (#9239) Fix radix issues (#9247) New info tooltip component (#9180) Improve scss naming ...
Fixes #9324 Possibly missed when #9183 was merged. The issue is that the same classname is overridding the intended flex-direction. https://github.com/MetaMask/metamask-extension/blob/46ba1ef1008d5111924132229c281a449ea1a13a/ui/app/css/itcss/components/newui-sections.scss#L98-L101
* Fix alignment of restore vault screen Fixes #9324 Possibly missed when #9183 was merged. The issue is that the same classname is overridding the intended flex-direction. https://github.com/MetaMask/metamask-extension/blob/46ba1ef1008d5111924132229c281a449ea1a13a/ui/app/css/itcss/components/newui-sections.scss#L98-L101








