Skip to content

Instantly share code, notes, and snippets.

@russweas
Last active December 21, 2018 06:26
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save russweas/774e01743ca63aa73b45 to your computer and use it in GitHub Desktop.
Save russweas/774e01743ca63aa73b45 to your computer and use it in GitHub Desktop.
Stylus BEM mixins
// Mixins.styl
has($name)
/&__{$name}
{block}
variant($name)
/&--{$name}
{block}
// Alert.styl
.Alert
background: lighten(gray, 80%)
padding: 15px
+has(close-button)
right: 10px
position: absolute
cursor: pointer
+variant(Success)
util-color(green)
// index.html
<div class="Alert Alert--Success">
<p>Lorem ipsum...</p>
<span class="Alert__close-button" @click="close">
x
</span>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment