Skip to content

Instantly share code, notes, and snippets.

@thomasgroch
Forked from russweas/mixins.styl
Created September 5, 2017 21:01
Show Gist options
  • Save thomasgroch/4535c03a80fdb9033a7c900c1f216b30 to your computer and use it in GitHub Desktop.
Save thomasgroch/4535c03a80fdb9033a7c900c1f216b30 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