Skip to content

Instantly share code, notes, and snippets.

@jackmcmorrow
Forked from nathos/sass-hash-mixin.sass
Last active December 19, 2015 20:18
Show Gist options
  • Save jackmcmorrow/6012115 to your computer and use it in GitHub Desktop.
Save jackmcmorrow/6012115 to your computer and use it in GitHub Desktop.
Faz 'tipo' uma hash no Sass, proporção de uma pra uma (1:1); Agradecimentos ao @nathos pelo bizu sensacional.
@mixin categoria-cores {
@each $categoria in $categorias {
.cat-#{nth($category, 1)} {
background-color: nth($category, 2);
}
}
}
// Categorias e a cor da categoria
// Isso é uma lista de listas, uma separada por vírgulas e a outra por espaços!
$categorias: site teal, juventude orange, poesia plum, ficcao salmon, escrita steelblue;
// O seletor placeholder que a gente ai extender -- placeholder selectors precisam de Sass 3.2
%category-colors {
@include category-colors
}
.category-banners {
li {
// @extend nos itens da lista.
@extend %category-colors;
}
}
/* Note that the placeholder class isn't output in the CSS */
.category-banners li .cat-site {
background-color: teal;
}
.category-banners li .cat-juventude {
background-color: orange;
}
.category-banners li .cat-poesia {
background-color: plum;
}
.category-banners li .cat-ficcao {
background-color: salmon;
}
.category-banners li .cat-escrita {
background-color: steelblue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment