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 #2

Open
Yeti-or opened this issue Jun 6, 2017 · 1 comment
Open

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

Yeti-or opened this issue Jun 6, 2017 · 1 comment

Comments

@Yeti-or
Copy link
Member

Yeti-or commented Jun 6, 2017

original: bem/bem-sdk#165

Possible candidate:

import b from '@bem/naming';

b('button2')('text') // button2__text
b('popup') // popup
b('popup)({theme: normal}) // popup_theme_normal
@Yeti-or
Copy link
Member Author

Yeti-or commented Jun 6, 2017

zxqfox :

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

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

skad0 :
carrier? seems pretty unexpected

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

As for me looks easier for reading and understanding.

zxqfox :

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

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

awinogradov :
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);

https://gist.github.com/awinogradov/8ca52fd3364486fe46791a7387fd550b

Yeti-or :
awinogradov let's make it part of @bem/naming as
zxqfox suggested

awinogradov :
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant