Skip to content

Instantly share code, notes, and snippets.

@Vlasterx
Last active November 12, 2015 08:05
Show Gist options
  • Save Vlasterx/03d803c6d3e4024b0be7 to your computer and use it in GitHub Desktop.
Save Vlasterx/03d803c6d3e4024b0be7 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
/*
EXTENDER MIXIN
author: Vladimir Jovanovic @vlasterx | www.webdizajn.org
2015.
*/
// Change to true/false to see the difference
$extender: true;
// CHECK BOOLEAN VALUE
// -------------------
@function bool($value: false) {
@if $value == false or
$value == "" or
$value == "false" or
$value == 'false' or
$value == 0 {
@return false;
}
@return true;
}
// EXTENDER MIXIN
// --------------
// Check to see if given class should be extended of rendered as unique
// Useful if you want to save some bandwidth in final render
@function extender($class, $ext: $extender) {
@if (bool($ext) == true) {
@return (#{'%'}#{$class});
}
@else {
@return (#{'.'}#{$class});
}
}
// EXAMPLE
// -------
// `clearfix` can be rendered as `.clearfix` or `%clearfix`
#{extender(clearfix)} {
&:after {
content: "";
display: table;
clear: both;
}
}
// `.test` class extends either `.clearfix` or `%clearfix`
.test {
padding: 10px;
@extend #{extender(clearfix)};
}
/*
EXTENDER MIXIN
author: Vladimir Jovanovic @vlasterx | www.webdizajn.org
2015.
*/
.test:after {
content: "";
display: table;
clear: both;
}
.test {
padding: 10px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment