Comments on: Developing Extensible HTML and CSS Components https://css-tricks.com/developing-extensible-html-css-components/ Tips, Tricks, and Techniques on using Cascading Style Sheets. Tue, 11 Apr 2017 00:31:33 +0000 hourly 1 https://wordpress.org/?v=6.1.1 By: Jon Yablonski https://css-tricks.com/developing-extensible-html-css-components/#comment-1604046 Sat, 10 Sep 2016 22:58:17 +0000 http://css-tricks.com/?p=244866#comment-1604046 In reply to Chernenko Konstantin.

Hi Chernenko. Yes, two dashes are used for modifier classes. All examples in the article follow this pattern.

]]>
By: Chernenko Konstantin https://css-tricks.com/developing-extensible-html-css-components/#comment-1604037 Sat, 10 Sep 2016 10:32:39 +0000 http://css-tricks.com/?p=244866#comment-1604037 Why for block—modifier used long-dash? It’s a typographical mistake, I think. Two minus should be for modifiers naming, is it correct?

]]>
By: Mike https://css-tricks.com/developing-extensible-html-css-components/#comment-1604010 Fri, 09 Sep 2016 13:27:13 +0000 http://css-tricks.com/?p=244866#comment-1604010 Really good article and great examples. I like the re usability aspect of this.

This may be a good topic of a future video on my site. Great work Jon.

]]>
By: Dan https://css-tricks.com/developing-extensible-html-css-components/#comment-1603931 Tue, 06 Sep 2016 13:22:32 +0000 http://css-tricks.com/?p=244866#comment-1603931 Nice article! Makes me think of this book: https://smacss.com/

Some principles are very similar to what you’re writing here. Very interesting for anyone interested in that topic. As I’m not a big fan of the BEM notation, I prefer to lay out things the way it’s done in this book (even if similar to BEM; I simply don’t like the double underscore/dash.. It’s personal, once again). Then it’s all down to how strict we are with ourselves I guess.

Nevertheless, interesting article! Thanks!

]]>
By: Jon Yablonski https://css-tricks.com/developing-extensible-html-css-components/#comment-1603926 Mon, 05 Sep 2016 21:54:45 +0000 http://css-tricks.com/?p=244866#comment-1603926 In reply to Ivan.

No worries Ivan!

I see what you mean, but it should be noted that block elements can contain other block elements. (for example: ‘media__item item’, ‘item’ is also a standalone block).

The purpose of the naming methodology is to show the relationship between parent and children clearly, which is something I find incredibly helpful with BEM. Again, it comes down to what works for you though.

]]>
By: Ivan https://css-tricks.com/developing-extensible-html-css-components/#comment-1603914 Mon, 05 Sep 2016 06:33:56 +0000 http://css-tricks.com/?p=244866#comment-1603914 In reply to Ivan.

Hello Jon! Thanks for your explanation! And my apologies if I rendered to be rude or something. The word “misused” is definitely wrong here.

My point is, as Marvin also mentioned, some devs just add whatever they need after __. As such, you__may__find__such__class–names sometimes :D

From my point of view, if something seems like a self standing thing, it ought to be split.

]]>
By: Jon Yablonski https://css-tricks.com/developing-extensible-html-css-components/#comment-1603908 Sat, 03 Sep 2016 23:14:50 +0000 http://css-tricks.com/?p=244866#comment-1603908 In reply to Neil Brown.

Thanks Neil!

]]>
By: Jon Yablonski https://css-tricks.com/developing-extensible-html-css-components/#comment-1603907 Sat, 03 Sep 2016 22:54:09 +0000 http://css-tricks.com/?p=244866#comment-1603907 In reply to Ivan.

My apologizes *Ivan.

]]>
By: Jon Yablonski https://css-tricks.com/developing-extensible-html-css-components/#comment-1603906 Sat, 03 Sep 2016 22:53:13 +0000 http://css-tricks.com/?p=244866#comment-1603906 In reply to Ivan.

Interesting point Evan, but I don’t think “misuse” would be accurate. It really comes down to what works best for you. Personally, I prefer seeing explicitly how children relate to the parent block. The relationship between block and element is clear (‘block__element’). This is part of the advantages of using a naming methodology such as BEM (or a modification of the syntax). The example you provided makes it seem like ‘media-info’ is a parent element and can exists on its own, which is misleading. I don’t mind ‘monolith’ because the naming makes the relationship of block, elements and modifiers very clear.

]]>
By: Neil Brown https://css-tricks.com/developing-extensible-html-css-components/#comment-1603899 Sat, 03 Sep 2016 08:06:54 +0000 http://css-tricks.com/?p=244866#comment-1603899 Very well written article.

I’m a big fan of BEM as it’s easy to read and works great with several developers.

We use two hyphens for modifiers to avoid confusing elements that are hyphenated.

Getting fundamentals correct early on help the developers, project managers and finally the clients.

]]>
By: Marvin Hagemeister https://css-tricks.com/developing-extensible-html-css-components/#comment-1603851 Thu, 01 Sep 2016 17:20:10 +0000 http://css-tricks.com/?p=244866#comment-1603851 In reply to Ivan.

I’m in the same boat as you and your last example looks a lot cleaner and easier to extend. Way to many people try to copy the actual DOM structure in their selectors.

]]>
By: Ivan https://css-tricks.com/developing-extensible-html-css-components/#comment-1603845 Thu, 01 Sep 2016 15:16:59 +0000 http://css-tricks.com/?p=244866#comment-1603845 Thanks for your article Jon! I also believe the web is all about components. In my opinion, you have misused the BEM. You have classes like media__body-list and media__body-list-title which I think do no belong to media block. Wouldn’t it be better to split the monolith into chunks? I’ll try to demonstrate it using simplified excerpt from your code:

.media.media--slat
  .media__item
    img(src="...")
  .media__body
    .media__body-title
    .media__body-list
      .media__body-list-title
      .media__body-list-data

can become

.media.media--slat
  .media__item
    img(src="...")
  .media__body
    .media__title
    .media-info
      .media-info__title
      .media-info__data

Thus, media info is a self contained thing. And even more, I guess this list has nothing to do with the media.

.media.media--slat
  .media__item
    img(src="...")
  .media__body
    .media__title
    .a-special-list
      .a-special-list__title
      .a-special-list__data

I personally always have such doubts. What are your thoughts on this matter?

]]>
By: Colin https://css-tricks.com/developing-extensible-html-css-components/#comment-1603821 Wed, 31 Aug 2016 13:52:29 +0000 http://css-tricks.com/?p=244866#comment-1603821 I’m using this method http://rscss.io
Looks like the same approach right?

]]>
By: Jon Yablonski https://css-tricks.com/developing-extensible-html-css-components/#comment-1603807 Wed, 31 Aug 2016 01:54:33 +0000 http://css-tricks.com/?p=244866#comment-1603807 In reply to Rhys L.

I totally agree Rhys

]]>
By: Rhys L https://css-tricks.com/developing-extensible-html-css-components/#comment-1603804 Tue, 30 Aug 2016 23:18:07 +0000 http://css-tricks.com/?p=244866#comment-1603804 We could take this methodology so much further if we had element/container queries.

]]>