Skip to content

Instantly share code, notes, and snippets.

@ariellephan
Last active September 28, 2016 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ariellephan/e87e7faf5b08a39014af55dcf99d84e2 to your computer and use it in GitHub Desktop.
Save ariellephan/e87e7faf5b08a39014af55dcf99d84e2 to your computer and use it in GitHub Desktop.
SCSS best practice
%button {
// … button styles
+ %button {
margin-left: 1rem;
}
}
%modal {
// … modal styles
%button {
// … modal-specific button styles
}
}
// "Exported" classes
.button { @extend %button; }
.modal { @extend %modal; }
//Output
.button { /* … button styles */ }
.button + .button { margin-left: 1rem; }
.modal { /* … modal styles */ }
.modal .button { /* … modal-specific button styles */ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment