Skip to content

Instantly share code, notes, and snippets.

@rcaracaus
Last active August 29, 2015 14:20
Show Gist options
  • Save rcaracaus/dabfa562273831983619 to your computer and use it in GitHub Desktop.
Save rcaracaus/dabfa562273831983619 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="magic-blue-box">magic-blue-box</div>
// ----
// Sass (v3.4.13)
// Compass (v1.0.3)
// ----
/*
Say you have two components in separate partials.
Magic Blue Box extends Block.
If _magic-blue-box.scss is included (say via Sass Globbing)
before _block.scss in styles.scss, you need to
use !important to manually give priority to
Magic Blue Box's overridding selectors.
The Compass Import Once gem solves this problem.
Not sure how to solve it in Libsass yet.
*/
/* _magic-blue-box.scss */
%magic-blue-box,
.magic-blue-box {
@extend %block;
color: blue !important;
}
/* _block.scss */
%block,
.block {
width: 200px;
height: 200px;
padding: 1rem;
background: rgba(blue, .1);
color: transparent;
}
/*
Say you have two components in separate partials.
Magic Blue Box extends Block.
If _magic-blue-box.scss is included (say via Sass Globbing)
before _block.scss in styles.scss, you need to
use !important to manually give priority to
Magic Blue Box's overridding selectors.
The Compass Import Once gem solves this problem.
Not sure how to solve it in Libsass yet.
*/
/* _magic-blue-box.scss */
.magic-blue-box {
color: blue !important;
}
/* _block.scss */
.magic-blue-box,
.block {
width: 200px;
height: 200px;
padding: 1rem;
background: rgba(0, 0, 255, 0.1);
color: transparent;
}
<div class="magic-blue-box">magic-blue-box</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment