Open FrancisVega opened 8 years ago
@FrancisVega hi!
What do you mean by plain js for blocks
?
Main idea is to use same selectors in JS as you use in CSS.
You may also keep JS files of each block in block's folder as well as CSS and any other techs (see https://en.bem.info/method/filesystem/).
But you may also use some libraries. E.g. here's a jQuery plugin to easily work with blocks, elements and modifiers: http://xslc.org/jquery-bem/
Or you may take a look at more powerful solution called i-bem.js
: https://en.bem.info/technology/i-bem/v2/i-bem-js/
@FrancisVega
i-bem.js
. js-
prefix for classes, used in js. You should think of it like a 'js-blocks', not just classes. Imagine, that you divide functional of your block by css and js code. And you can use thats css and js parts independently each other.Using js- prefix is bad practice, try to avoid it. Just use the same class for css and js functionality.
Hi all! Is there any guide or examples to write plain js for blocks?
Thanks!