Skip to content

Instantly share code, notes, and snippets.

@avataru
Last active August 29, 2015 13:56
Show Gist options
  • Save avataru/9268928 to your computer and use it in GitHub Desktop.
Save avataru/9268928 to your computer and use it in GitHub Desktop.
Compass extensions and SASS snippets

YIQ Contrast: code

Photoshop Gradient Overlay

Photoshop Drop Shadows


Media query mixing that uses maps

$breakpoints: (
  desktop: 1280px,
  tablet-portrait: 1024px,
  phone-portrait: 360px
);

@mixin mq($device) {
  @if map-has-key($breakpoints, $device) {
    @media (max-width: map-get($breakpoints, $device)) {
      @content;
    }
  }
  @else {
    // Can be used thanks to map-has-key() instead of loop
    @warn "Breakpoint '#{$device}' doesn't exist!"
  }
}

.foo {
  width: 50%;

  @include mq(tablet-portrait) {
    width: 100%;
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment