Answer the question
In order to leave comments, you need to log in
How to use pure JS according to BEM?
Good day, friends!
The crux of the matter is this.
I'm still using pure JS and could you explain to me how to implement it correctly according to BEM.
Look, for each block, as I understand it, its own JS file is used, and then, as I understand it, all these JS files are combined into one. And since initially, at the coding stage, they are all in different files, it is rather difficult to keep track of the variables not being repeated in their names.
What would be the best way to avoid this problem without violating the BEM methodology?
At the moment I'm using a rather strange method and I'm not sure if it's good at all.
Here's an example of what I'm doing now, I'm just wrapping the code in a function with the same block name
. in html i have block with class .banner
And in JS:
(function banner () {
... //некий код
}());
Answer the question
In order to leave comments, you need to log in
according to BEM
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question