bem-walk icon indicating copy to clipboard operation
bem-walk copied to clipboard

To have a way to read single (or several) blocks files

Open qfox opened this issue 9 years ago • 2 comments

Probably the scheme like nested but just for one block.

https://nda.ya.ru/3RHPRF

qfox avatar Jan 28 '16 14:01 qfox

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/']

blond avatar May 10 '16 20:05 blond

Can we try to make it? We really need it for watch or partial scan and there are no other options to do it ;-(

qfox avatar Apr 20 '17 13:04 qfox