Skip to content

Instantly share code, notes, and snippets.

@Kcko
Created February 19, 2015 19:01
Show Gist options
  • Save Kcko/e3adfbfbf924edb78c4c to your computer and use it in GitHub Desktop.
Save Kcko/e3adfbfbf924edb78c4c to your computer and use it in GitHub Desktop.
Generování cyklů z pole / lists
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
/*! 1 zpusob pres lists a funkci nth */
$flash_types: (success #d4ffd4), (error #ffd5d1);
@each $flash_def in $flash_types {
$type: nth($flash_def, 1);
$colour: nth($flash_def, 2);
.#{$type} {
background-image: url(../images/#{$type}.png);
}
}
/* 2 zpusob pomoci tzv. multiple assignment */
$animals: (puma, black, default),
(sea-slug, blue, pointer),
(egret, white, move);
@each $animal, $color, $cursor in $animals {
.#{$animal}-icon {
background-image: url('/images/#{$animal}.png');
}
}
/*! 1 zpusob pres lists a funkci nth */
.success {
background-image: url(../images/success.png);
}
.error {
background-image: url(../images/error.png);
}
/* 2 zpusob pomoci tzv. multiple assignment */
.puma-icon {
background-image: url("/images/puma.png");
}
.sea-slug-icon {
background-image: url("/images/sea-slug.png");
}
.egret-icon {
background-image: url("/images/egret.png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment