β‡  chan.dev / posts

Compare AVO πŸ₯‘ and standard BEM Conventions

AVO πŸ₯‘ : BEM (standard) syntax comparison

This is a chart, mapping AVO πŸ₯‘ syntax to standard BEM verbiage.

AVO πŸ₯‘ is a syntactive dialect of BEM’s Block, Element, Modifier constructs.
This reference describes AVO πŸ₯‘ naming conventions in BEM terms β€”Β as defined on bem.info.

Block

A functionally independent component that can be reused.

/* BEM */
.avatar {
}
/* AVO πŸ₯‘ */
[data-avatar] {
}
<!-- BEM -->
<img class="avatar" src="…" alt="…" />
<!-- AVO πŸ₯‘ -->
<img data-avatar src="…" alt="…" />

Element

A composite part of a block that can’t be used separately from it.

/* BEM */
.avatar {
}
.avatar__img {
}
/* AVO πŸ₯‘ */
[data-avatar] {
}
[data-avatar--img] {
}
<!-- BEM -->
<span class="avatar">
<img class="avatar__img" src="…" alt="…" />
</span>
<!-- AVO πŸ₯‘ -->
<span data-avatar>
<img data-avatar--img src="…" alt="…" />
</span>

Modifier

An entity that defines the appearance, state, or behavior of a block or an element.

/* BEM */
.avatar--status_ok {
}
/* AVO πŸ₯‘ */
[data-avatar~='status:ok'] {
}
<!-- BEM -->
<img class="avatar avatar--status_ok" src="…" alt="…" />
<!-- AVO πŸ₯‘ -->
<img data-avatar="status:ok" src="…" alt="…" />