Skip to content

Instantly share code, notes, and snippets.

@giovannif23
Last active September 14, 2021 03:33
Show Gist options
  • Save giovannif23/c7db39238aed5c0cddcf276cd25086cf to your computer and use it in GitHub Desktop.
Save giovannif23/c7db39238aed5c0cddcf276cd25086cf to your computer and use it in GitHub Desktop.
Sass naming style options
/**
* ELEMENT NAMING
*/
// NAMING STYLE V1 (true BEM)
.k-input {
@apply border-gray-200;
@apply rounded;
// ELEMENTS .k-input__icon
&__icon {
@apply color-blue;
}
// MODIFIERS .k-input.k-input--error
&--error {
@apply color-red;
}
}
// NAMING STYLE V2 (shortened)
.k-input {
@apply border-gray-200;
@apply rounded;
// ELEMENTS .k-input_icon
&_icon {
@apply color-blue;
}
// MODIFIERS .k-input.k-input-error
&-error {
@apply color-red;
}
}
// NAMING STYLE V3 (simplified modifier class)
.k-input {
@apply border-gray-200;
@apply rounded;
// ELEMENTS .k-input_icon
&_icon {
@apply color-blue;
}
// MODIFIERS .k-input.-error
.-error {
@apply color-red;
}
}
/**
* MODIFIER NAMING
*/
.k-input {
@apply border-gray-200;
@apply rounded;
// MODIFIERS V1 k-input.-error
.-error {
@apply color-red;
}
.-open {
@apply block;
}
// MODIFIERS V2 k-input.has-error
.has-error {
@apply color-red;
}
.is-open {
@apply block;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment