2.0.0 • Published 6 years ago

nano-bem v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

nano-bem

A tiny library to generate BEM-style class names. Influenced by bem-cn: https://github.com/albburtsev/bem-cn.

Example Usage

import React from 'react';
import block from 'nano-bem';
import './index.css';

const b = block('my-block');

class MyBlock extends React.PureComponent {
  render() {
    return (
      <div className={b()}>
        I am ".my-block"
        <div className={b('top')>
          I am ".my-block__top"
        </div>
        <div className={b('bottom', { foo: true, bar: 'orange' })>
          I am ".my-block__bottom .my-block__bottom_foo .my-block__bottom_bar_orange"
        </div>
      </div>
    );
  }
}

With css-loader's "modules" setting (https://github.com/webpack-contrib/css-loader#modules):

import React from 'react';
import block from 'nano-bem';
import css from './index.css';

const b = block('my-block', css);
// local class names will be mapped to unique identifiers
...
2.0.0

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago