Skip to content

Instantly share code, notes, and snippets.

@ruedap
Created January 27, 2015 06:09
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 ruedap/c632a36cb21d30a36566 to your computer and use it in GitHub Desktop.
Save ruedap/c632a36cb21d30a36566 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
.block
.block__element foo
.is--responsive
.block
.block__element bar
// ----
// Sass (v3.4.9)
// Compass (v1.0.1)
// ----
=media($target)
.is--responsive &
@if $target == mobile
@media screen and (max-width: 767px)
@content
@if $target == tablet
@media screen and (min-width: 768px)
@content
.block
&__element
color: red
+media(mobile)
color: green
+media(tablet)
color: blue
.block__element {
color: red;
}
@media screen and (max-width: 767px) {
.is--responsive .block__element {
color: green;
}
}
@media screen and (min-width: 768px) {
.is--responsive .block__element {
color: blue;
}
}
<div class='block'>
<div class='block__element'>foo</div>
</div>
<div class='is--responsive'>
<div class='block'>
<div class='block__element'>bar</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment