Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Yeti-or committed Jan 31, 2017
1 parent 8ae5027 commit b4f5b5a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -208,6 +208,12 @@ $ npm i @bem/naming

[#158]: https://github.com/bem-sdk/bem-naming/pull/158

### Presets

* Added react preset (@yeti-or [#161]).

[#161]: https://github.com/bem-sdk/bem-naming/pull/161

### Performance

* Accelerated initialization for `origin` naming (@tadatuta [#134]).
Expand Down
26 changes: 26 additions & 0 deletions README.md
Expand Up @@ -48,6 +48,7 @@ Table of Contents
* [String representation](#string-representation)
* [Common misconceptions](#common-misconceptions)
* [Harry Roberts' naming convention](#harry-roberts-naming-convention)
* [React naming convention](#react-naming-convention)
* [Custom naming convention](#custom-naming-convention)
* [API](#api)

Expand Down Expand Up @@ -129,6 +130,31 @@ twoDashesNaming.stringify({
// ➜ block__elem--mod
```

React naming convention
-----------------------

According to this convention elements are delimited with one hyphen (`-`), modifiers are delimited by one underscore (`_`), and values of modifiers are delimited by one underscore (`_`).

You can explore this convention at [bem-react-components](https://github.com/bem/bem-react-components).

Example:

```js
const reactNaming = require('@bem/naming')('react');

reactNaming.parse('block-elem'); // BemEntityName { block: 'block', elem: 'elem' }
reactNaming.parse('block_mod_val'); // BemEntityName { block: 'block',
// mod: { name: 'mod', val: 'val' } }

reactNaming.stringify({
block: 'block',
elem: 'elem',
mod: 'mod'
});

// ➜ block-elem_mod
```

Custom naming convention
------------------------

Expand Down

0 comments on commit b4f5b5a

Please sign in to comment.