Skip to content

Instantly share code, notes, and snippets.

@andzi
Forked from iamstarkov/bem.md
Created September 6, 2016 16:28
Show Gist options
  • Save andzi/eabbb91d8b588cf8f06bce16541855dc to your computer and use it in GitHub Desktop.
Save andzi/eabbb91d8b588cf8f06bce16541855dc to your computer and use it in GitHub Desktop.
bem

Дано:

Макет блока

Проблема

Адская разметка http://pastie.org/9625163

Решение

Первая итерация:

.grid
	.grid__row
		.grid__cell.grid__cell_size_6
			+lead-news()
		.grid__cell.grid__cell_size_3
			+news-list()

.lead-news
	.lead-news__link
		.lead-news__title
		.lead-news__counters
			.lead-news__counter.lead-news__counter_state_views
			.lead-news__counter.lead-news__counter_state_comments
			.lead-news__counter.lead-news__counter_state_likes
		.lead-news__more

.news-list
	.news-list__item
		.news-list__info
			.news-list__date
			.news-list__type
		.news-list__desc
			.news-list__link
				.news-list__image
				.news-list__title
			.counters
				.counters__item.counters__item_state_views
				.counters__item.counters__item_state_comments
				.counters__item.counters__item_state_likes
	.news-list__item
		…

Очевидно, что необходимо выделить блок counters.

Вторая итерация:

.grid
	.grid__row
		.grid__cell.grid__cell_size_6
			+lead-news()
		.grid__cell.grid__cell_size_3
			+news-list()

.lead-news
	.lead-news__link
		.lead-news__title
		+counters().counters_color_white
		.lead-news__more

.news-list
	.news-list__item
		.news-list__info
			.news-list__date
			.news-list__type
		.news-list__desc
			.news-list__link
				.news-list__image
				.news-list__title
		+counters()
	.news-list__item
		…
	.news-list__item
		…
		
.counters
	.counters__item
		.counters__icon.counters__icon_type_views
		.counters__number
		state_views
	.counters__item
		.counters__icon.counters__icon_type_comments
		.counters__number
	.counters__item
		.counters__icon.counters__icon_type_likes
		.counters__number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment