-
Notifications
You must be signed in to change notification settings - Fork 466
Conversation
…s these were already being removed by Autoprefixer.
…In400’ to match other names
…use consistently. Fix durations to match mixin/class name.
…and RTL-specific overrides
…s commit, no change from master)
…applied after. Turn RTL Animation mixins into a simple override.
…t to bring variables and mixins to Fabric.scss
I still believe file names should include their category (animation-variable,animation-mixins, animation-classes etc). It'll help a ton in fuzy searching and code review. |
@micahgodbolt: So your preference on file names would be |
Thanks for doing this @mikewheaton! I'll pull down your branch to check out your changes soon. So excited to finally get these cleaned up! Things were starting to get huge and crusty. |
@micahgodbolt @Jahnp: I'd also like feedback on Would it make sense to see something like |
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.
General feedback: is there a reason the root-level "output" files are prefixed with an underscore like partials? I understand that they are still generating CSS, but unless I'm missing something, it seems odd for them to have that prefix.
|
||
// Fade | ||
@mixin ms-u-fadeIn100 { | ||
animation-duration: 0.1s; |
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.
Totally understand the motivation here and agree that the original name/value mismatch for these was confusing, but I'm quite sure at the time the values were intentional/by design. While it's probably fine to change them to make more sense, please check with motion design to verify.
Frankly, I'd prefer we use simple, predictable durations in sensible increments like you've proposed here.
@Jahnp: The underscore in Sass/SCSS indicates a partial, which is any file that is included by others and doesn't directly output a CSS file. Our build system doesn't care about the underscore, so it really makes no difference, but I wanted to follow this convention that others might recognize. It's also used by Bootstrap and Foundation. |
@mikewheaton: I see--so it prevents there from being a |
I've updated the variable and mixin file names to include their type (e.g. |
@mikewheaton I also hear you on the reasoning behind the naming of I think the biggest thing would be to just make sure we call out the breaking change, because I know there are many projects that would be affected by this. |
@Jahnp: I'm not strongly against "Common", I just preferred "References" a bit more. It will be a breaking change in any case because the old files were all prefixed with "Fabric", so it's a good opportunity to change the name if we want to. |
Approved Thanks again for doing this @mikewheaton! |
@mikewheaton sweet work here! Looking forward to seeing this repo being soooo much better organized. |
|
||
// Base font stacks | ||
$ms-font-system-base: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif !default; | ||
$ms-font-family-base: 'Segoe UI WestEuropean', $ms-font-system-base !default; |
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.
Should that be 'Segoe UI West European'?
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.
This will be investigated more closely in #382. Do you remember if 'Segoe UI WestEuropean' is supposed to refer to a locally-installed font? We have a web font for it on the CDN, but I can't find a corresponding @font-face
declaration that makes this available.
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.
No, 'Segoe UI' is the local system font ($ms-font-system-base fonts are all local system fonts). 'Segoe UI West European' is the friendly name for the web font. Not sure why it's 'WestEuropean' here (unless I missed something in the last several months.)
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.
The web font is spelled as 'WestEuropean': https://github.com/OfficeDev/office-ui-fabric-core/blob/master/src/sass/mixins/_Font.Mixins.scss#L141
I'm going to open a new issue to include "Web Font" in the name of any @font-face
we declare. It's difficult to tell right now where we're expecting a system font to load and where it's a web font we've defined, which we can name whatever we like. 😄
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.
oops. nevermind.
|
||
// Generate classes for product and document icons | ||
@mixin brandIconClasses($retina) { | ||
@each $icon in $ms-productIcons { |
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.
Is this intentionally tabbed out like 8 spaces per tab? Or is it the github viewer that is making look gigantic?
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.
Good catch. Looks like this file is using tabs instead of spaces. We're going to be adding linting (#869) soon to keep inconsistencies like this from getting checked in.
@@ -85,7 +85,7 @@ $high-contrast-green: #3ff23f; | |||
|
|||
// slideLeftIn80 | |||
@mixin ms-u-slideLeftIn80 { | |||
@include animationMix((fadeIn, slideLeftIn80), $ms-duration3, $ms-ease1); | |||
@include ms-animation((fadeIn, slideLeftIn80), $ms-duration3, $ms-ease1); |
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.
to me this namespacing looks like a vendor prefix and makes it more vague
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 agree that the "ms" prefix isn't the best indicator of "this belongs to Fabric". There are some legacy reasons for this and we'd likely choose another prefix if we were starting fresh today. However, at this point we use that prefix on all of our CSS classes and many variables and mixins, so changing it would be a major hassle for developers updating to new versions. Our goal, for now, is to at least be consistent, even if the prefix is slightly confusing.
This PR restructures the
sass
folder to remove the confusing "output" file names (fixes #349), giving us a new structure like so:All of the variables and mixins are clearly separated out from the partials that actually generate CSS. Those partials use the underscore naming convention (e.g.
_Grid.scss
) to indicate that they shouldn't be converted directly to CSS. The only files without the underscore areFabric.scss
andFabric.RTL.scss
.Along the way, I discovered several other bugs and inconsistencies, many of which are fixed by this PR. Here are the changes and fixes:
No impact on output CSS or use of mixins/partials
_Fabric.i18n.scss
. We replaced this with another file a while back, now located inmixins/_Directionality.Mixins.scss
, but this original hadn't been deleted. Fortunately, it was loaded before the proper mixins and had no effect on the output.slideLeft400
toslideLeftIn400
to match the others. This is a change only in the@keyframes
name and does not impact the mixins or class names.Fabric.RTL.scss
now simply importsFabric.scss
and then references RTL-specific overrides. Reduces the chance of future bugs caused by adding a reference to one file and not the other.Changes to mixins/partials
ms-animation-keyframes()
, that outputs all of the@keyframes
used by the animation classes. Previously, you could use mixins to add animation to an element, but that animation wouldn't work because the@keyframes
were unavailable.animationMix()
mixin toms-animation()
. I'll be renaming more mixins and variables in a future PR to fix Scope all mixins and variables, and name them consistently #832, as we're inconsistent here and should be scoping them all._Fabric.Base.scss
to_Wrapper.scss
, so we can consistently refer to it as the 'wrapper' class. No change to the actual output ofms-Fabric
._Fabric.Common.scss
to_References.scss
and made sure this contains all of the variables and mixins. Then imported this file intoFabric.scss
so that no references are missed.ms-Grid-col()
mixin now styles child.ms-Grid
classes, so that grids can be nested correctly.Typography
files toFont
to match the actual variable/mixin/class names.Differences in the output CSS
fabric.css
now contains the language overrides for font stacks (fixes Language font stack overrides missing from fabric.css #865).fabric.rtl.css
contained many animation classes that were referring to@keyframes
by the wrong name. This meant that the animations weren't working in RTL. They now refer to the correct animations:slideLeftIn10
,slideLeftIn20
,slideLeftIn40
,slideRightIn10
,slideRightIn20
,slideRightIn40
, andslideRight400
.fabric.rtl.css
now includes the BrandIcon classes (fixes Brand Icons missing from fabric.rtl.css #866).With so many file changes it's hard to look at the diffs, so I've used the super-helpful Alan's Compare CSS tool to compare the master versions of
fabric.css
andfabric.rtl.css
with the versions from this branch. I went through several times to be sure I'm not introducing any unintended changes.