Last active
November 12, 2015 08:05
-
-
Save Vlasterx/03d803c6d3e4024b0be7 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// 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)}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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