use everywhere. $black $text-color $border-color $grey $light-grey $dark-border Other things like border, text, and form variables $facebook-blue $twitter-blue I also like to put social network or common colors used from popular sites. You never know when you’ll need them.
case we need them on another property. $berry-purple $brigade-yellow $throttle-red Don’t go Variable Crazy! Colors: 199 After a quick audit, we found our CSS was a mess. Our Sass wasn’t organized and it was quickly abandoned after frustrated dev after dev just wrote standard CSS. Font Size: 145 Font Family: 45 Width: 715 Position: 182 Don’t repeat yourself 45 different shades of grey
common variables here, then we would have to override them later for each property. This would be problematic. $chive-green; url(#{$common-img-dir}/bg.jpg); $chive-green; darken($chive-green, 8%); lighten($chive-green, 14%);
} .element { Don’t lock your styles in when you’re working in the _common.scss files. Know when and where you need to be flexible and allow yourself room to grow.
… base … In each property’s style.scss file, we would have to place the overrides underneath the _variables.scss file and before the modules so the values would cascade down.
… base … This is a problem because when we add more modules, we would have to add them to all 4 stylesheets. It’s a lot of duplication and again, a lot of room for error. mo modules, mo problems
… base … Let’s keep all the common files together and include the variables in each property’s stylesheet that way we can maintain it on a per property basis.
you define them after the original. With !default, it works the other way around. $variable: ‘two’; value = ‘two’ $variable: ‘two’; $variable: ‘one’ !default; value = ‘two’ If $variable is defined before !default, that overrides it. If it’s never defined, then !default is the value.
common variables here, then we would have to override them later for each property. This would be problematic. $chive-green; url(#{$common-img-dir}/bg.jpg); $chive-green; darken($chive-green, 8%); lighten($chive-green, 14%);
we know will change based on the property using !default. But first, let’s take a step back. $grey !default; url(#{$common-img-dir}/bg.jpg) !default; $chive-green !default; darken($chive-green, 8%) !default; lighten($chive-green, 14%) !default;
… We’re not going to compile the common styles as a separate stylesheet since we don’t want to load two CSS files. Instead we’re going to import it in each property’s style.scss file.
As a bonus, because we’ve imported _common.scss here, we can drop any other style overrides underneath it and keep our core styles cleaner and less cluttered.