Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
feat(component): add an option to bem utility to not output element c…
Browse files Browse the repository at this point in the history
…lass

this allows users to avoid displaying multiple element level classnames
when there are multiple modifier classes
  • Loading branch information
rayrutjes committed Oct 10, 2017
1 parent b3ba8af commit 6d4e690
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default {
}
},
methods: {
bem(element, modifier) {
bem(element, modifier, outputElement) {
if (!this.blockClassName) {
throw new Error("You need to provide 'blockClassName' in your data.");
}
Expand All @@ -65,6 +65,9 @@ export default {

const elementModifierClassName = `${elementClassName}--${modifier}`;

if (outputElement !== undefined && outputElement === false) {
return this.customClassName(elementModifierClassName);
}
return `${this.customClassName(elementClassName)} ${this.customClassName(
elementModifierClassName
)}`;
Expand Down

0 comments on commit 6d4e690

Please sign in to comment.