A BEM(Block Element Modifier) classes generator.
BEM — is a methodology that helps you to create reusable components and code sharing in front‑end development.
NET 6.0 or later
dotnet add package BemIt
using BemIt;
var card = new Block("card"); // card
var outlinedCard = card.Modifier("outlined"); // card--outlined
var cardTitle = card.Element("title"); // card__title
var largeCardTitle = cardTitle.Modifier("large"); // card__title--large
using BemIt;
enum Density
{
Dense,
Comfortable,
Compact,
}
var outlined = true;
var isDisabled = true;
var density = Density.Dense;
var cardModifierBuilder = new Block("card")
.CreateModifierBuilder()
.Add(outlined)
.Add("disabled", isDisabled)
.Add(density)
.AddClass("theme--light");
var cardClasses = cardModifierBuilder.Build();
// output: card card--outlined card--disabled card--density-dense theme--light