-
Notifications
You must be signed in to change notification settings - Fork 465
Consistent scope and naming for variables, mixins, and keyframes #887
Conversation
This reverts commit 3b244b0.
clear: left; | ||
} | ||
} @else { | ||
clear: $side; | ||
} | ||
} | ||
|
||
@mixin float($direction) { | ||
@mixin ms-float($direction) { |
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.
Hmm... this is going to cause a lot of upgrade pain. Are we confident this is the right change to make?
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.
It's never fun when we introduce breaking changes, but it is a simple find-replace in this case. There's no change in functionality so once all of the build errors are caught it's good to go. I'm planning on doing the update in Fabric React and can help if other teams have concerns.
margin: $top $left $bottom $right; | ||
} | ||
} | ||
|
||
@mixin margin-left($distance) { | ||
@include LTR { | ||
@mixin ms-marginLeft($distance) { |
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.
I realize the intent here is to be as consistent as possible across the library and to prevent any potential conflicts when using other SASS libraries, but the names of the directionality mixins were meant to match the CSS properties they affect to make their usage as transparent as possible. I won't block on this right now, but I again do worry that this will be a painful upgrade for a lot of users.
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.
It's certainly a 'nice to have' that all of the mixins follow the same naming convention and not an absolute must. My thinking was that since we're breaking everything by adding the "ms-" prefix anyway, it's a good opportunity to standardize the name.
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.
Another option could be to update our other mixins (the ones that don't directly output CSS classes, where we match the names) to use kebab-case.
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.
After discussing in person, we're going to go ahead and kebab case all of the mixins while keeping the "ms-" prefix: ms-margin-left()
# Conflicts: # src/sass/_Font.scss # src/sass/mixins/_Animation.Mixins.scss
…ess they are strictly to output a CSS class)
When naming classes, animation keyframes, variables, and mixins, please follow these conventions: | ||
|
||
- Everything in the global scope is prefixed with "ms-". | ||
- CSS classes remain unchanged (following [SUIT CSS conventions](https://github.com/suitcss/suit/blob/master/doc/naming-conventions.md)). |
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.
Line talks about things being unchanged. Good for PR notes, not needed for docs.
Fixes #832.
This PR adds scoping (via the
ms-
prefix) and makes the naming of mixins, variables, and keyframes more consistent.With the exception of the brand icon modifier classes (see below), there are no other changes to the CSS classes in Fabric, so while this is a breaking change it won't affect the majority of applications using Fabric as a simple CSS include.
New naming convention
ms-Grid-col
ms-Icon--EraseTool
@keyframes ms-slideRightIn10
$ms-animation-duration-3
$ms-screen-min-xl
$ms-color-themeLighterAlt
ms-focus-border()
ms-drop-shadow()
ms-u-borderBox()
outputs to.ms-u-borderBox
ms-fontSize-s()
outputs to.ms-fontSize-s
Breaking changes
Animation keyframes
slideRightIn10
toms-slideRightIn10
Classes
ms-BrandIcon--Icon16
toms-BrandIcon--icon16
Mixins
reset-padding
toms-reset-padding
brandIconClasses
toms-brand-icon-classes
SegoeUIWestEuropeanLight
toms-font-family-segoeUIWestEuropeanLight
language-override-system-fonts
toms-font-family-override
ms-baseFont
toms-base-font
baseRtl
toms-base-RTL
resetAnimation
toms-reset-animation
resetMargins
toms-reset-margins
Variables
ms-screen-sm-min
toms-screen-min-sm
ms-ease2
toms-animation-ease-2
ms-productImagesPath
toms-product-images-path
ms-font-family-base
toms-font-base-family
ms-font-system-base
toms-font-base-system