Skip to content

Instantly share code, notes, and snippets.

@gandhiShepard
Created September 12, 2014 04:18
Show Gist options
  • Save gandhiShepard/60988dea34af0f58c09a to your computer and use it in GitHub Desktop.
Save gandhiShepard/60988dea34af0f58c09a to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.3)
// Compass (v1.0.1)
// ----
// Function needed for the mixin
// Thanks Hugo! http://hugogiraudel.com/2013/08/08/advanced-sass-list-functions
@function remove-list-items($list, $value) {
$result: ();
@for $i from 1 through length($list) {
@if type-of(nth($list, $i)) == list {
$result: append($result, remove-list-items(nth($list, $i), $value));
}
@else if nth($list, $i) != $value {
$result: append($result, nth($list, $i));
}
}
@return $result;
}
// Mixin
@mixin am($args) {
@if length($args) == 1 {
[am-#{$args}] {
@content;
}
}
@else {
$attr: nth($args, 1);
$val: remove-list-items($args, nth($args, 1));
[am-#{$attr}~="#{$val}"] {
@content;
}
}
}
// Usage
@include am(button) {
content: "";
}
@include am(button large) {
content: "";
}
@include am(button large rounded) {
content: "";
}
@include am(row) {
content: "";
}
@include am(column) {
content: "";
}
@include am(column "1/12") {
content: "";
}
[am-button] {
content: "";
}
[am-button~="large"] {
content: "";
}
[am-button~="large rounded"] {
content: "";
}
[am-row] {
content: "";
}
[am-column] {
content: "";
}
[am-column~="1/12"] {
content: "";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment