Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Add elements support #2

@mrozbarry

Description

@mrozbarry

It is a pain to re-type a set of elements if they are being used frequently, ie:

bem = new Bemmer({block: 'my-block'})

MyComponent className: bem.with({element: 'my-component'}),
  MySubComponent className: bem.with({element: 'my-component-child'})
  MySubComponent2 className: bem.with({element: 'my-component-child2'})

Why not allow the following syntax?

bem = new Bemmer({block: 'my-block'})
elems = ['my-component']

MyComponent className: bem.with({elements: elems}),
  MySubComponent className: bem.with({elements: elems.concat('child')})
  MySubComponent2 className: bem.with({elements: elems.concat('child2')})

With heavier nesting in a single component, this syntax could considerably reduce complexity, while sacrificing some readability.

Would this feature be useful to anyone?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions