Skip to content

Instantly share code, notes, and snippets.

@Vlasterx
Created November 6, 2015 11:18
Show Gist options
  • Save Vlasterx/b86c5c2c3ffa6f1ac4fa to your computer and use it in GitHub Desktop.
Save Vlasterx/b86c5c2c3ffa6f1ac4fa to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
// Setting object
$resolutions : (
mobile: (
name: mobile,
shortcut: m,
width: 320px
),
tablet: (
name: tablet,
shortcut: t,
width: 800px
)
);
// Looping through all variables
@each $i in $resolutions {
// First we take name of sub-object
$res_name: (nth($i, 1));
// Then we load object variables
$dev: map-get($resolutions, $res_name);
.loop-#{$res_name} {
width: map_get($dev, width);
}
}
// Calling one variable without looping
$dev: map-get($resolutions, mobile);
.single-#{map_get($dev, name)} {
width: map-get($dev, width);
}
.loop-mobile {
width: 320px;
}
.loop-tablet {
width: 800px;
}
.single-mobile {
width: 320px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment