Skip to content

Commit

Permalink
Docs: Clarify class naming convention. (#15764)
Browse files Browse the repository at this point in the history
The paragraph description is difficult to parse, even if you already understand the intent behind it. A straight-forward example using generic labels is a much clearer way to communicate.
  • Loading branch information
iandunn authored and gziolo committed May 23, 2019
1 parent ce29311 commit 6b024af
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/contributors/coding-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ This living document serves to prescribe coding guidelines specific to the Guten

To avoid class name collisions, class names **must** adhere to the following guidelines, which are loosely inspired by the [BEM (Block, Element, Modifier) methodology](https://en.bem.info/methodology/).

All class names assigned to an element must be prefixed with the name of the package, followed by the name of the directory in which the component resides. Any descendent of the component's root element must append a dash-delimited descriptor, separated from the base by two consecutive underscores `__`. The root element is considered to be the highest ancestor element returned by the default export in the `index.js`. Notably, if your folder contains multiple files, each with their own default exported component, only the element rendered by that of `index.js` can be considered the root. All others should be treated as descendents.
All class names assigned to an element must be prefixed with the name of the package, followed by a dash and the name of the directory in which the component resides. Any descendent of the component's root element must append a dash-delimited descriptor, separated from the base by two consecutive underscores `__`.

* Root element: `package-directory`
* Child elements: `package-directory__descriptor-foo-bar`

The root element is considered to be the highest ancestor element returned by the default export in the `index.js`. Notably, if your folder contains multiple files, each with their own default exported component, only the element rendered by that of `index.js` can be considered the root. All others should be treated as descendents.

**Example:**

Expand Down

0 comments on commit 6b024af

Please sign in to comment.