bem-walk
bem-walk copied to clipboard
To have a way to read single (or several) blocks files
Probably the scheme like nested but just for one block.
https://nda.ya.ru/3RHPRF
I think we can get declaration instead of path parameter.
blocks/
button/
button.css
button.js
const config = require('bem-config')();
const walk = require('bem-walk');
walk({ block: 'button' }, { levels: config.levelMapSync() });
// is equal
walk(['blocks/button/'], { levels: config.levelMapSync() });
Each item of declaration can be transform to some paths with bem-fs-scheme.path().
const path = require('path');
const nestedScheme = require('bem-fs-scheme')('nested');
const dirname = nestedScheme.path({ block: 'button' }) // button/
levels.map(level => path.join(level, dirname)); // ['blocks/button/']
Can we try to make it? We really need it for watch or partial scan and there are no other options to do it ;-(