N
N
nublog2014-09-29 21:34:15
css
nublog, 2014-09-29 21:34:15

Are CSS sprites compatible with BEM?

Hi all!
I have been doing layout for a long time, at the moment I want to switch to BEM. While I deal with the folder structure, class names. In test mode, I make up a small project in manual mode. When I understand the structure, I will switch to a full-fledged BEM.
As far as I understand, one of the tasks of BEM is layout with independent blocks, and here I have a question: if we use CSS sprites, does this mean that we destroy the principle of independence of blocks in advance by attaching one graphic file to different elements with all, for example, icons?
By analogy, we look at the file structure of the block:

menu/
  __item/
    _state/
      menu__item_state_current.css
      menu__item_state_current.xsl
    menu__item.css
    menu__item.xsl
  menu.css
  menu.js
  menu.xsl

Here, for example, CSS-files are divided, including by elements. Why do images have to be "special" then?
But if, nevertheless, separate graphic elements are separated, how to store them? Or in the folder of the block or element to which the image belongs? or create a folder "Images" in the root? And what to do with the number of requests to the server?
PS: I understand that everything is relative, that everyone adjusts "for themselves", but nevertheless...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Petrov, 2014-09-29
@nublog

You can store images in folders, individually.
And during the assembly process, collect all this into one sprite.
I don't see any problem with this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question