Box-Of-Hats / Bem-VSCode-Extension

A VSCode extension for helping with inserting BEM (Block-Element-Modifier) classes.
BSD 3-Clause "New" or "Revised" License
29 stars 5 forks source link

Possible new option: Skip some classes entirely. #45

Closed macakronos closed 3 years ago

macakronos commented 3 years ago

Hello, thank you for your contribution to the community.

I want to propose the addition of a characteristic: allow to specify in the configuration which classes should be completely omitted.

For example, sometimes some css classes are used from frameworks like Bootstrap that you want to skip completely, in any case it can be removed manually, but it can take your time in a large project, with many components.

Thanks for everything. Config BEM

Box-Of-Hats commented 3 years ago

Hi, thanks for the recommendation :) The good news is that it's already a feature under the setting bemHelper.ignoreClassNames.

For example:


  "bemHelper.ignoreClassNames": ["col-12", "aside"],
macakronos commented 3 years ago

I have already tried that option but I still get these classes in the generated code. Besides that in the description it says that it has another utility.

A list of class names that should be ignored as parents (blocks) when inserting new elements

Box-Of-Hats commented 3 years ago

I see now, thanks for clarifying. That will be a new feature but it sounds straightforward enough to add. I'll look at this soon! :)

macakronos commented 3 years ago

Thanks for your time.

Box-Of-Hats commented 3 years ago

Version 1.4.3 has just been released which includes that fix. The stylesheet generation will now respect your ignored classes list.

Thanks again for your suggestion 🚀

macakronos commented 3 years ago

For some reason it doesn't work for me. I put "col-12" to ignore me, but it keeps generating it. I have verified that I have the latest version of the extension.

Box-Of-Hats commented 3 years ago

Can you paste in some example HTML where you're having the issue so I can also try with it?

macakronos commented 3 years ago

This is `

    </div>`
macakronos commented 3 years ago

My settings "bemHelper.sortGeneratedStylesheets": false, "bemHelper.ignoreClassNames": [ "video-w-image", "col-12", "aside", "material-icons" ]

Box-Of-Hats commented 3 years ago

Thanks for sending that over, it really helped with debugging this one :)

I've released a fix in version 1.4.4 which should sort this out.

macakronos commented 3 years ago

Thank you. It works excellent.