Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement easy-breezy API for constructing bem-string #165

Closed
Yeti-or opened this issue Feb 9, 2017 · 8 comments
Closed

Implement easy-breezy API for constructing bem-string #165

Yeti-or opened this issue Feb 9, 2017 · 8 comments

Comments

@Yeti-or
Copy link
Member

Yeti-or commented Feb 9, 2017

Possible candidate:

import b from '@bem/naming';

b('button2')('text') // button2__text
b('popup') // popup
b('popup)({theme: normal}) // popup_theme_normal
@qfox
Copy link
Member

qfox commented Feb 9, 2017

import { carrier } from '@bem/naming';
const carrier = require('@bem/naming/carrier');

carrier('button2')('text')...

@skad0
Copy link
Contributor

skad0 commented Feb 9, 2017

carrier? seems pretty unexpected

@skad0
Copy link
Contributor

skad0 commented Feb 9, 2017

b('button2').e('text').m({ theme: 'normal' })

As for me looks easier for reading and understanding.

@qfox
Copy link
Member

qfox commented Feb 9, 2017

import { b_ } from '@bem/naming';
const b_ = require('@bem/naming/b_');

b_('button2')('text')...

@awinogradov
Copy link
Member

I want!) World is ready to this magic)

I like @skad0 implementation:

b('button2').e('text').m({ theme: 'normal' })

Also, would be great add mix helper:

const b1 = b('button2').e('text').m({ theme: 'normal', size: 'm' });
const b2 = b('sharik').e('palka').m({ dva: 'struna' });

b('dagestan').m({ moya: 'strana' }).mix(b1, b2);

@awinogradov
Copy link
Member

@Yeti-or
Copy link
Member Author

Yeti-or commented May 7, 2017

@awinogradov let's make it part of @bem/naming as
@zxqfox suggested

@awinogradov
Copy link
Member

I've made temporary package easy-bem-naming for testing this kind API. We'll try to use it in the bem-react-core and then we can implement it here in bem-naming with stable API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants