Skip to content

Comments

Rename folder blocks → common.blocks#74

Open
Vittly wants to merge 4 commits intobem:masterfrom
Vittly:rename-blocks-folder
Open

Rename folder blocks → common.blocks#74
Vittly wants to merge 4 commits intobem:masterfrom
Vittly:rename-blocks-folder

Conversation

@Vittly
Copy link

@Vittly Vittly commented Mar 17, 2018

Needed to build it with webpack-bem-plugin.

Why?

  1. Plugin is built on bem-sdk — new version of bem-tools/bem-config
  2. Modern version of bemrc (used by bem-sdk) should define level in a form { layer: 'foo' } for folder "foo.blocks". Defining level with path property is deprecated
  3. Naming presets also relay on layer property

There is no simple way to handle "bem-react-components" with custom folder "blocks" and build projects by webpack-bem-plugin or other builder using bem-sdk.

I've created an issue about it and found no other way. May be after this issue we can get better decision. For now is better to use simple approach: "If bem-react-components defines common blocks we put them in so called folder"

@Vittly
Copy link
Author

Vittly commented Mar 17, 2018

@awinogradov @Yeti-or check my PR please

@Vittly Vittly force-pushed the rename-blocks-folder branch from d125b31 to 9606494 Compare March 17, 2018 18:45
@awinogradov
Copy link
Member

сс @tadatuta

@tadatuta
Copy link
Member

I think bem-config should support folders like blocks, blocks-common and all the other custom variations. will find out the way to support it.

@Vittly
Copy link
Author

Vittly commented Mar 20, 2018

bem-config is deprecated see subtitle at github page. I am talking about bem-sdk/config

@Vittly
Copy link
Author

Vittly commented Mar 20, 2018

@tadatuta reasonably noted that all we need is to declare a custom preset for "bem-react-components" like:

// based on react preset
module.exports = {
    delims: {
        elem: '-',
        mod: { name: '_', val: '_' }
    },
    fs: {
        delims: { elem: '' },
        pattern: 'blocks/${entity}.${tech}',
        scheme: 'nested'
    },
    wordPattern: '[a-zA-Z0-9]+'
};

But "bem-react-components" should be simple and such complex thing like full naming form is too much. May be we can give an option to define naming preset based on one of standard presets.

This is much simpler:

module.exports = {
    basedOn: 'react',
    fs: { patter: 'blocks/${entity}.${tech}' } 
};

@qfox
Copy link
Member

qfox commented Mar 20, 2018

Actually, you can do this without basedOn field:

const { react } = '@bem/sdk.naming.presets';
module.exports = { ...react, fs: { ...react.fs, pattern: '${entity}.${tech}' } };

And path to library (or to level if you want) should contains blocks/.

btw. Do you want to join us at this weekend to dive into webpack world?

@Vittly
Copy link
Author

Vittly commented Mar 21, 2018

basedOn is shorter =) we can add it here

@qfox
Copy link
Member

qfox commented Mar 24, 2018

тогда уж extends

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

Successfully merging this pull request may close these issues.

4 participants