Open qfox opened 8 years ago
I think we can move sources
options to first argument:
const src = require('gulp-bem-src');
src(String[], {
config: BemConfig,
bemdecl: *,
techs: String[],
techsAliases: ?Object<String,String[]>
}): Stream<BemVinyl?>
Reasons:
sources
option is required.gulp.src()
The config
option is not required. If this option is not specified we should find .bemrc
file in project root.
Alse we should support gulp.src
options: https://github.com/gulpjs/vinyl-fs#options
techsAliases: ?Object<String,String[]>
techsAliases
-> techAliases
?
class BemVynil extends Vynil { entity: BemEntity }
I think we should use native Vynil
.
The config option is not required. If this option is not specified we should find .bemrc file in project root.
I suggest to lookup .bemrc from gulpfile directory and further as usual.
This API is more like a gulp.src()
In gulp.src we have src(globs[, options])
in opposite to src(levels[, options])
, it's an incorrect comparison at my pov.
With the idea to put required options as soon as possible, I'd say we should put declaration as the first argument because its like globs just for bem project instead of pure fs.
Alse we should support gulp.src options: https://github.com/gulpjs/vinyl-fs#options
Good point!
According to all comments seems like it should looks like this:
src(decl: Tenorok[], techs: String|String[], [, options: {
config: ?BemConfig, // Should be loaded from .bemrc by default
sources: ?String[], // Should use levels from config by default and throw if nothing found
techAliases: ?Object<String,String[]> // Should use aliases from .bemrc if any
// vfs.src options:
buffer: Boolean=true,
read: Boolean=true,
since: ?(Date|Number),
stripBOM: Boolean=true,
passthrough: Boolean=false,
sourcemaps: Boolean=false,
followSymlinks: Boolean=true, // we should pass it to bem-walk?
dots: Boolean=false // pointless?,
// etc.
}]): Stream<Vinyl>
Like that, right? I suggest to support them (all set of options) iteratively to not block anything else.
In gulp.src we have src(globs[, options]) in opposite to src(levels[, options]), it's an incorrect comparison at my pov.
I think we should support globs.
bemSrc('*.blocks', {...})
Also we can use globs as bemdecl
or techs
options:
bemSrc('*.blocks/button/**', {...})
With the idea to put required options as soon as possible, I'd say we should put declaration as the first argument because its like globs just for bem project instead of pure fs.
In some projects we can build only one bundle with all sources.
I think we should support globs.
I think it's not blocking feature so we can do it later ;-)
It should realize this: