Closed andre487 closed 8 years ago
it should be implemented as separate package which uses bem-naming
as bem-naming
itself is all about one entity
Can it be separate method in bem-naming? E. g. bemNaming.fromBemJson(bemJson)
The bem-naming
works with one entity (stringify object or parse string).
BEMJSON contains several entities, so it looks more like a declaration.
If you want convert BEMJSON to BEMDECL need use bemjson-to-decl package:
import bemNaming from 'bem-naming';
import toDecl from 'bemjson-to-decl';
const bemjson = {
block: 'page',
mods: { type: 'inner' },
mix: {
block: 'page-404',
elem: 'content',
elemMods: { type: 'any' }
}
};
const bemdecl = toDecl(bemjson);
bemdecl.map(bemNaming.stringify); // page page_type_inner page-404__content_type_any
If you still have questions, reopen this issue or create a new issue.
Thanks! It's the solution
Will be very helpful if there will be full BEMJSON support: