Skip to content

Instantly share code, notes, and snippets.

@procload
Created September 22, 2014 17:34
Show Gist options
  • Save procload/329785c9e2eac1e25e4e to your computer and use it in GitHub Desktop.
Save procload/329785c9e2eac1e25e4e to your computer and use it in GitHub Desktop.
Fonts
%brandon-700 { @include typekit-font(brandon, 700); }

The reason I think it might shrink the size of our styleheets is the way that @include vs. @extend works. If we had three declarations in SASS like so:

h2 {
	@include typekit-font(brandon, 700);
}

.my-class h2 {
	@include typekit-font(brandon, 700);
}

.another-class h2 {
	@include typekit-font(brandon, 700);
}

// Resulting Output
h2 {
	family: 'brandon-grotesque', helvetica, sans-serif;
	weight: 700;
}

.my-class h2 {
	family: 'brandon-grotesque', helvetica, sans-serif;
	weight: 700;
}

.another-class h2 {
	family: 'brandon-grotesque', helvetica, sans-serif;
	weight: 700;
}

But if we used @extend instead it would look like the following:

h2 {
	@extend %brandon-700;
}

.my-class h2 {
	@extend %brandon-700;
}

.another-class h2 {
	@extend %brandon-700;
}

// Resulting Output
h2, .my-class h2, .another-class h2 {
	family: 'brandon-grotesque', helvetica, sans-serif;
	weight: 700;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment