Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework walking logic to support pattern field #282

Open
qfox opened this issue Feb 6, 2018 · 4 comments
Open

Rework walking logic to support pattern field #282

qfox opened this issue Feb 6, 2018 · 4 comments

Comments

@qfox
Copy link
Member

qfox commented Feb 6, 2018

Feels like it's all the things we should do for pattern support. Not a huge deal for real.

More ideas on Russian: bem-sdk-archive/bem-walk#77
More details on Russian: https://gist.github.com/zxqfox/02bacc8c5d44b425f819228cdf0756d3

Closes #282

@belozer
Copy link
Member

belozer commented Feb 6, 2018

pattern: '${entity}/${tech}', scheme: 'nested'

I correctly understand that this code describes such a file structure?

common.blocks/block/index.js
common.blocks/block/__elem/index.js
common.blocks/block/__elem/_mod/index.js
common.blocks/block/__elem/_mod_val/index.js
@qfox
Copy link
Member Author

qfox commented Feb 6, 2018

Almost. This:

common.blocks/block/js
common.blocks/block/__elem/js
common.blocks/block/__elem/_mod/js
common.blocks/block/__elem/_mod_val/js

You need: pattern: '${entity}/index.${tech}', scheme: 'nested'

@belozer
Copy link
Member

belozer commented Feb 6, 2018

I probably brought a very abstract example for fs.

From real world

common.blocks/block/vanilla.js 
// -> { entity : { block : 'block' }, tech : 'vanilla.js' }

common.blocks/block/__elem/browser.js 
// -> { entity : { block : 'block' , elem : 'elem' }, tech : 'browser.js' }

common.blocks/block/__elem/_mod/bemtree.js
// -> { entity : { block : 'block' , elem : 'elem', mod : { name : 'mod', val : true }, tech : 'bemtree.js' }

common.blocks/block/__elem/_mod_val/bemhtml.js
// -> { entity : { block : 'block' , elem : 'elem', mod : { name : 'mod', val : 'val' }, tech : 'bemhtml.js' }
@qfox
Copy link
Member Author

qfox commented Feb 6, 2018

Then your pattern is the correct one. ;-)

But scheme should be corrected a little. Nested will match these files:

common.blocks/block/__elem/_mod/block__elem_mod/bemtree.js
common.blocks/block/__elem/_mod/block__elem_mod_val/bemhtml.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment