bem-sdk-archive / bem-decl

:capital_abcd: Manage declaration of BEM entities. DEPRECATED →
https://github.com/bem/bem-sdk/tree/master/packages/decl
Other
11 stars 3 forks source link

String Only Format #17

Closed blond closed 7 years ago

blond commented 9 years ago

BEMDECL next should support string only format of declaration.

var normalize = require('bem-decl').normalize,
    decl = [
        'block',
        'block_mod',
        'block_mod-name_mod-val',
        'block__elem'
    ];

normalize(decl, { version: 'next' });
// [
//     { block: 'block' }],
//     { scope: 'block', modName: 'mod', modVal: true }],
//     { scope: 'block', modName: 'mod-name', modVal: 'mod-val' }],
//     { scope: 'block', elem: 'elem' }]
// ]

This format should support custom naming conventions.

var normalize = require('bem-decl').normalize,
    csswizardry = { elem: '__', mod: '--' },
    decl = [
        'block',
        'block--mod',
        'block__elem'
    ];

normalize(decl, { version: 'next', naming: csswizardry });
// [
//     { block: 'block' }],
//     { scope: 'block', modName: 'mod', modVal: true }],
//     { scope: 'block', elem: 'elem' }]
// ]
blond commented 7 years ago

It is not the task of this package.