azproduction / b_ Goto Github PK
View Code? Open in Web Editor NEWBEM class name formatter
License: MIT License
BEM class name formatter
License: MIT License
Is this expected to be so:
b('button', { size: undefined })
// 'button button_size_undefined'
Shouldn't it be button button_size
or button
?
Would be great to have section in readme with links on projects with another approaches to bringing bem naming in react:
Hi! I am using b_ in my project and including it into bundles. There is a problem in ie8, it errors when running the b.with
line of the b_:
and here the 274th line of my bundle, this function is from b_ module
Replacing all b.with
with b['with']
solves the problem, but var bem = require('b_')['with']('myBlock');
looks not so good. It seems that .with
function should be renamed.
there is no license declared for this project. its kinda a problem
var B = require('b_');
var Array_of = function (any) {
return Array.prototype.slice.call(any);
};
B.with = function () {
var b = this,
curriedArgs = Array_of(arguments);
return function () {
return b.apply(null, curriedArgs.concat(Array_of(arguments)));
};
};
var b = B.with('b-button');
var e = B.with('b-button', 'elem');
// After
function render() {
return (
<div className={b()}>
<span className={b('icon', {type: 'add'})}></span>
<span className={b('text')}></span>
</div>
<div className={b({size: 'small'})}>
<span className={b('icon', {type: 'add'})}></span>
<span className={b('text')}></span>
</div>
);
}
// Before
function render() {
return (
<div className={b('b-button')}>
<span className={b('b-button', 'icon', {type: 'add'})}></span>
<span className={b('b-button', 'text')}></span>
</div>
<div className={b('b-button', {size: 'small'})}>
<span className={b('b-button', 'icon', {type: 'add'})}></span>
<span className={b('b-button', 'text')}></span>
</div>
);
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.