NOTE I now use the conventions detailed in the SUIT framework
Used to provide structural templates.
Pattern
t-template-name
| /* Commonly used mixins for CSS3 in SASS | |
| by Ben Sargent (2012) | |
| www.brokendigits.com | |
| */ | |
| /* generically prefix any property name */ | |
| @mixin prefix($name, $value) { | |
| -webkit-#{$name}: $value; | |
| -moz-#{$name}: $value; |
| var hasjQuery = false; | |
| jQueryCheck = function() { | |
| if (! window.jQuery) { | |
| if (! hasjQuery) { | |
| hasjQuery = true; | |
| var script = document.createElement('script'); | |
| script.type = 'text/javascript'; | |
| script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'; | |
| document.getElementsByTagName('body')[0].appendChild(script); | |
| } |
| // Turns out this function already exists in Sass: mix(fg, bg, %) (http://d.pr/mGqa) | |
| // Alpha blending | |
| @function blend($bg, $fg) { | |
| $r: red($fg) * alpha($fg) + red($bg) * (1 - alpha($fg)); | |
| $g: green($fg) * alpha($fg) + green($bg) * (1 - alpha($fg)); | |
| $b: blue($fg) * alpha($fg) + blue($bg) * (1 - alpha($fg)); |
| // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
| // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
| // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
| // MIT license | |
| (function() { | |
| var lastTime = 0; | |
| var vendors = ['ms', 'moz', 'webkit', 'o']; |
| @mixin background-image-retina($file, $type, $width, $height) { | |
| background-image: url($file + '.' + $type); | |
| @media (-webkit-min-device-pixel-ratio: 2), (-moz-min-device-pixel-ratio: 2) { | |
| & { | |
| background-image: url($file + '@2x.' + $type); | |
| -webkit-background-size: $width $height; | |
| } | |
| } | |
| } |
NOTE I now use the conventions detailed in the SUIT framework
Used to provide structural templates.
Pattern
t-template-name