-
Notifications
You must be signed in to change notification settings - Fork 7
Ability to read just some part of level instead of full walk #14
Comments
Now you can scan levels only fully: var walk = require('bem-walk');
walk(['blocks']) // scan all entities in specified levels For me partial scan suggests API which uses the path: var walk = require('bem-walk');
walk('blocks/button') // scan block with its elements and its mods
walk('blocks/button/_mod') // scan mods of block
walk('blocks/button/__elem') // scan elem with its mods But for var walk = require('bem-walk'),
opts = { scheme: 'flat' };
walk('blocks/button', opts) // scan block with its elements and its mods
walk('blocks/button_mod', opts) // scan mod of block
walk('blocks/button__elem', opts) // scan elem |
👍 👍 👍 |
Okay, let's move to #16 then. |
@zxqfox, it's a different issues ;) |
А у Жеки 3 руки! )) |
Это я просто очень рад ;) |
@andrewblond If you've made #16 this task will go higher to builder or level-configurator. What's for we need it in walker? |
I think better to just make a upd I'm not sure that this issue is critical because of #20 |
Isn't it more common for streams to have special events for each kind of thing we're looking for? var walk = require('bem-walk');
walk(['common.blocks', 'desktop.blocks']).on('entity') // same as walk(['common.blocks', 'desktop.blocks'])
walk(['common.blocks', 'desktop.blocks']).on('block') // all blocks, ignore elems and mods
walk(['common.blocks', 'desktop.blocks']).on({ block: 'button' }) // same as walk('*.blocks/button') |
|
There is issue #21 about it |
the case is the same as in @andrewblond's suggestion to get just all techs of current block and its elements and mods
alright then :) |
I can't get what for? |
e.g. to provide block info on bem.info |
We can calculate depth of level in core for file or dir and provide this info to schemes (schemes should support The depth calculate by the number of
Example:
Scan project filesconst config = require('bem-config')();
const walk = require('bem-walk');
const levelMap = config.levelMapSync();
walk({ levels: levelMap });
// depth for 'common.blocks' path is -1
// it is mean that need scan all levels in this directory Scan the levelconst config = require('bem-config')();
const walk = require('bem-walk');
const levelMap = config.levelMapSync();
walk('common.blocks', { levels: levelMap });
// depth for 'common.blocks' path is 0 Scan only
|
This is exactly that feature what I need to developing plugin for search BEM-entities from the editor! |
Is this the same as "Ability to stop walking at some point"?
The text was updated successfully, but these errors were encountered: