Y
Y
Yevhenii K2018-07-22 22:21:14
HTML
Yevhenii K, 2018-07-22 22:21:14

How to add a BEM element using emmet?

I use VS Code + emmet + bem.
As you can see from the example, when I want to add an element with the class to an existing block .card__inner, we get a block with a modifier instead.
5b55904157e33400016074.jpeg5b55904a03a54575883409.jpeg.card__inner+TAB ----> How to add an element with class ? And the second question, how to add a comment using for certain tags, and not for all that contain a class or id? <div class="card card--inner"></div>
.card__inner
|c

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
motr, 2018-07-23
@motr

in settings add:

"emmet.syntaxProfiles": {
    "html": {
      "filters": "html, bem"
    }
  },
  "emmet.preferences": {
    "bem.elementSeparator": "__",
    "bem.modifierSeparator": "--",
    "bem.shortElementPrefix": "-",
    "lorem.defaultLang": "en"
  },

the syntax is as follows:
Regarding the second question, you need to smoke emmet settings, namely filters
And in vscode, in "emmet.preferences": {} write what you want to see in the comment
For example:
"emmet.preferences": {
    "filter.commentBefore": "<!-- [#ID][.CLASS] -->\n",
    "filter.commentAfter": "\n<!-- [#ID][.CLASS] end -->"
},

Also, in order not to constantly write | c to display a comment, you can again add a setting:
"emmet.syntaxProfiles": {
    "html" : {
      "filters" : "html, c"
    }
},

M
malayamarisha, 2021-02-04
@malayamarisha

Unable to create ul with classes and nesting
ul.section__list>li.section__item>a.section__link
In phpStorm, the construction works without problems

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question