Skip to content

Instantly share code, notes, and snippets.

@joekukish
Last active August 29, 2015 14:05
Show Gist options
  • Save joekukish/8d689be20c54d1237301 to your computer and use it in GitHub Desktop.
Save joekukish/8d689be20c54d1237301 to your computer and use it in GitHub Desktop.
Stylus 'gradient()' mixin
// Adds a linear gradient with the background coral fallback. The
// last parameter is optional
//
// background: gradient(top, #FFFFFF, #000000, 50%);
//
gradient() {
if current-property {
// the fallback for IE
add-property(current-property[0], mix(arguments[1], arguments[2], arguments[3]?arguments[3]:50%));
linear-gradient(arguments[0], arguments[1], arguments[2]);
} else {
error('gradient() must be used within a property');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment