Skip to content

Instantly share code, notes, and snippets.

@manufaktor
Created April 4, 2013 10:58
Show Gist options
  • Save manufaktor/5309499 to your computer and use it in GitHub Desktop.
Save manufaktor/5309499 to your computer and use it in GitHub Desktop.
// Font-face mixin
@mixin font-face($name, $path, $weight: normal, $style: normal){
@font-face {
font-family: $name;
src: url('#{$path}.eot');
src: url('#{$path}.eot?#iefix') format('embedded-opentype'),
url('#{$path}.woff') format('woff'),
url('#{$path}.ttf') format('truetype'),
url('#{$path}.svg#BariolRegularRegular') format('svg');
font-weight: $weight;
font-style: $style;
}
}
// Keyframes mixin
@mixin keyframes($animation-name) {
@-webkit-keyframes $animation-name {
@content;
}
@-moz-keyframes $animation-name {
@content;
}
@-ms-keyframes $animation-name {
@content;
}
@-o-keyframes $animation-name {
@content;
}
@keyframes $animation-name {
@content;
}
}
// IE7 hack
@mixin ie7 {
* + html & {
@content;
}
}
// IE styles using Paul Irish's conditional comments
@mixin ie7 {
html.ie7 & {
@content;
}
}
@mixin ie8 {
html.ie8 & {
@content;
}
}
@mixin ie9 {
html.ie9 & {
@content;
}
}
// Retina (based on https://gist.github.com/3446599)
@mixin retina($ratio: 1.3) {
@media only screen and (-webkit-min-device-pixel-ratio: $ratio),
only screen and (min--moz-device-pixel-ratio: $ratio),
only screen and (-o-min-device-pixel-ratio: ($ratio*10)/10),
only screen and (min-resolution: #{round($ratio*96)}dpi),
only screen and (min-resolution: #{$ratio}dppx) {
@content;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment