Skip to content
This repository has been archived by the owner on Aug 1, 2019. It is now read-only.

Add support for @bem/cell #11

Merged
merged 4 commits into from
Jan 25, 2017
Merged

Add support for @bem/cell #11

merged 4 commits into from
Jan 25, 2017

Conversation

Yeti-or
Copy link
Member

@Yeti-or Yeti-or commented Jan 24, 2017

closing #10
Example of new API:

var scheme = require('bem-fs-scheme');
scheme().path(
    new BemCell({
        entity: new BemEntityName({
            block: 'a',
            elem: 'e1',
            mod: {name: 'mn', val: 'mv'}
        }),
        tech: 'js',
        layer: 'common.blocks'
    })
)
// "common.blocks/a/__e1/_mn/a__e1_mn_mv.js"

options for bem-naming could be passed as second argument:

var scheme = require('bem-fs-scheme');
scheme().path(bemCell, {naming: {elem: '%%%', mod: '###'}})

@Yeti-or
Copy link
Member Author

Yeti-or commented Jan 24, 2017

If you noticed I didn't break API cause this package is already 1.0.0.
Another options that I see:

  1. 2.0.0
  2. Add different method for bem-cell
  3. Create new module:
var path = require('@bem/path')('nested');
path.resolve(new BemCell({
        entity: new BemEntityName({
            block: 'a',
            elem: 'e1'
        }),
        tech: 'js',
        layer: 'common.blocks'
    })
);

@Yeti-or
Copy link
Member Author

Yeti-or commented Jan 24, 2017

or even:

var path = require('@bem/path');
path.resolve(new BemCell({
        entity: new BemEntityName({
            block: 'a',
            elem: 'e1'
        }),
        tech: 'js'
    })
);

path.flat().resolve(new BemCell({
        entity: new BemEntityName({
            block: 'a',
            elem: 'e1'
        }),
        tech: 'js'
    })
);

@Yeti-or
Copy link
Member Author

Yeti-or commented Jan 24, 2017

@zxqfox @blond @skad0 take a look.

@Yeti-or Yeti-or requested a review from qfox January 24, 2017 05:22
@@ -3,31 +3,22 @@ var path = require('path'),
bemNaming = require('bem-naming');

module.exports = {
path: function(entity, tech, options) {
path: function(cell, options) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should throw an exception if there isn't BemCell?

@Yeti-or
Copy link
Member Author

Yeti-or commented Jan 25, 2017

@skad0 add assertion

Copy link
Member

@skad0 skad0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Yeti-or Yeti-or merged commit b429e11 into master Jan 25, 2017
@Yeti-or Yeti-or deleted the yeti-or.bem-cell branch January 25, 2017 16:21
@Yeti-or Yeti-or restored the yeti-or.bem-cell branch January 25, 2017 16:24
@Yeti-or Yeti-or deleted the yeti-or.bem-cell branch January 25, 2017 16:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants