Skip to content

Instantly share code, notes, and snippets.

@timschoch
Created February 16, 2016 11:53
Show Gist options
  • Save timschoch/f39290ae7042a9e2eb44 to your computer and use it in GitHub Desktop.
Save timschoch/f39290ae7042a9e2eb44 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class="foo">
<input />
<button>Search</button>
</div>
<div class="bar">
<input />
<button>Search</button>
</div>
// ----
// libsass (v3.2.5)
// ----
// the searchbox object (or map)
$searchBox: (
border: 1px solid red,
width: 400px
);
// the corresponding searchBox mixin.
@mixin searchBox($options: $searchBox) {
$options: map-merge( $searchBox, $options);
display: flex;
border: map-get($options, border);
margin-bottom: 30px;
padding: 10px;
width: map-get($options, width);
// obviously the html must be the same for all instancse
input {
flex: 1;
}
button {
width: 80px;
}
}
// applying OOSCSS
.foo {
@include searchBox;
}
.bar {
@include searchBox((
width:300px,
border: 5px solid green
));
}
.foo {
display: flex;
border: 1px solid red;
margin-bottom: 30px;
padding: 10px;
width: 400px;
}
.foo input {
flex: 1;
}
.foo button {
width: 80px;
}
.bar {
display: flex;
border: 5px solid green;
margin-bottom: 30px;
padding: 10px;
width: 300px;
}
.bar input {
flex: 1;
}
.bar button {
width: 80px;
}
<div class="foo">
<input />
<button>Search</button>
</div>
<div class="bar">
<input />
<button>Search</button>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment