All Projects β†’ ideyuta β†’ Nbem

ideyuta / Nbem

Licence: mit
πŸ’Ž nbem is for intuitively write the class name of BEM method. React and others.

Programming Languages

javascript
184084 projects - #8 most used programming language
js
455 projects

Projects that are alternatives of or similar to Nbem

Augur Ui
Augur UI
Stars: ✭ 412 (+1371.43%)
Mutual labels:  bem
Unifi Api Client
A PHP API client class to interact with Ubiquiti's UniFi Controller API
Stars: ✭ 602 (+2050%)
Mutual labels:  class
Watimage
πŸ–Ό PHP image manipulation class
Stars: ✭ 25 (-10.71%)
Mutual labels:  class
Jvm
πŸ€— JVM εΊ•ε±‚εŽŸη†ζœ€ε…¨ηŸ₯θ―†ζ€»η»“
Stars: ✭ 7,756 (+27600%)
Mutual labels:  class
Arui Feather
Alfa-Bank UI library
Stars: ✭ 571 (+1939.29%)
Mutual labels:  bem
Boilerform
Boilerform is a little HTML and CSS boilerplate to take the pain away from working with forms.
Stars: ✭ 679 (+2325%)
Mutual labels:  bem
Mam mol
$mol - fastest reactive micro-modular compact flexible lazy ui web framework.
Stars: ✭ 385 (+1275%)
Mutual labels:  bem
Structvsclassperformance
POC for my Medium article
Stars: ✭ 11 (-60.71%)
Mutual labels:  class
Nth Start Project
Startkit for HTML / CSS / JS pages layout.
Stars: ✭ 578 (+1964.29%)
Mutual labels:  bem
Koa Dec Router
An ES6 decorator + class based router, support inherit, override, priority, auto load controllers, etc.
Stars: ✭ 19 (-32.14%)
Mutual labels:  class
Postcss Bem Linter
A BEM linter for postcss
Stars: ✭ 505 (+1703.57%)
Mutual labels:  bem
Getbem.com
Get BEM to all people in simplest way
Stars: ✭ 5,186 (+18421.43%)
Mutual labels:  bem
Reclass.net
More than a ReClass port to the .NET platform.
Stars: ✭ 766 (+2635.71%)
Mutual labels:  class
Bemto
Smart mixins for writing BEM in Pug
Stars: ✭ 429 (+1432.14%)
Mutual labels:  bem
Es6 Class Bind All
Automaticlly bind 'this' scope of all methods in es6 class
Stars: ✭ 10 (-64.29%)
Mutual labels:  class
Tentcss
🌿 A CSS survival kit. Includes only the essentials to make camp.
Stars: ✭ 400 (+1328.57%)
Mutual labels:  bem
Avalanche
Superclean, powerful, responsive, Sass-based, BEM-syntax CSS grid system
Stars: ✭ 627 (+2139.29%)
Mutual labels:  bem
Enb Borschik
ENB tech to run borschik
Stars: ✭ 13 (-53.57%)
Mutual labels:  bem
Mcdowell Cv
A Nice-looking CV template made into LaTeX
Stars: ✭ 855 (+2953.57%)
Mutual labels:  class
Classcat
Build a class attribute string quickly.
Stars: ✭ 832 (+2871.43%)
Mutual labels:  class

nbem

nbem is for intuitively write the class name of BEM method.

NPM version NPM downloads Build Status Dependency Status DevDependency Status License

Installation

npm i nbem

Usage

Use with node.js, browserify, webpack:
var nbem = require(nbem);
var bem = nbem();

'&' is indicates the nests.

bem('header'); // => "header"
bem('&nav'); // => "header__nav"
bem('&&item'); // => "header__nav__item"

':' is indicates the modifier.

bem('header:global'); // => "header--global"
bem('&nav'); // => "header--global__nav"
Join classnames:

Add a string or string[] at second argument.

bem('header'); // => "header"
bem('&nav', 'isActive'); // => "header__nav isActive"
bem('&nav', ['isActive', 'isHover']); // => "header__nav isActive isHover"
bem('&&item'); // => "header__nav__item"
Customize separator:
var config = require(nbem).config;
config.setSeparator('-', '_'); // element, modifier

bem('header:global'); // => "header-global"
bem('&title') // => "header-global_title"

Example

in React of ES6

import React from 'react';
import nbem from 'nbem';

export default class Header extends React.Component {
  render() {
    const bem = nbem();
    return (
      <header className={bem('header')}>
        <h1 className={bem('&title')}>Title</h1>
        <p className={bem('&description')>Description</p>
      </header>
    );
  }
}

Render:

<header class="header">
  <h1 class="header__title">Title</h1>
  <p class="header__description">Description</p>
</header>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].