Skip to content

Instantly share code, notes, and snippets.

@rossberenson
Last active May 16, 2020 22:27
Show Gist options
  • Save rossberenson/b9a0ec8b4191b3f9ce512d09f14d4542 to your computer and use it in GitHub Desktop.
Save rossberenson/b9a0ec8b4191b3f9ce512d09f14d4542 to your computer and use it in GitHub Desktop.
SCSS Mixin to use with What-Input
/**
* Mixin for What-Input
* https://github.com/ten1seven/what-input
*
* Example use:
* .element {
* @include what-input(keyboard) {
* outline: 1px dotted black;
* }
*/
@mixin what-input($input) {
$available-inputs: keyboard, mouse, touch;
@if index($available-inputs, $input) {
html[data-whatinput="#{$input}"] & {
@content;
}
}
@else {
@error "Sorry, but #{$input} is not an available input. The available inputs are: #{$available-inputs}.";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment