W
W
wakenbyWork2021-08-24 18:31:27
css
wakenbyWork, 2021-08-24 18:31:27

What is the best way to type?

In general, I type according to the bem methodology, I split the project into blocks as much as possible and this is how they look:

61250ef2b7daa245141796.png
612513320bc7c660909346.png

That is, my entire project consists of pug + scss, and I connect these blocks where necessary. But all this began to bother me, although I wrote a cli that generates all the files, there is still a feeling that I am only complicating my work.

You also need to add classes to these blocks from the outside, and damn you write this all the time:

mixin button()
  .button(class=attributes.class) //- (class=attributes.class) Вот такое к каждому блоку к которому нужно добавлять класс


In general, how to layout in terms of architecture? Am I correct in splitting the entire project into particles?

I feel like I've only made things harder for myself than I've made it easier.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
imko, 2021-08-25
@imko

This is a big complication, besides the fact that it takes you a lot of time to create a block, it will take even more time to change, and it will take a hundred years to assemble it. Instead of BEM, there are CSS selectors, and instead of PUG, manual changes.
If it is critical for you to have such a strict naming structure and you cannot use selectors for some reason and want to fence giant classes in html, then you need BEM. And if you still have instances of one block on a couple of dozen pages that you need to change only in one (very conditionally one, if you have a generation from an array, for example, then nifiga is not in one place), then you also need PUG)
In general, I would not complicate If I were you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question