Skip to content
This repository has been archived by the owner on Mar 25, 2018. It is now read-only.

Primary functionality #2

Open
qfox opened this issue Jul 14, 2016 · 9 comments
Open

Primary functionality #2

qfox opened this issue Jul 14, 2016 · 9 comments

Comments

@qfox
Copy link
Member

qfox commented Jul 14, 2016

It should realize this:

const src = require('gulp-bem-src');

src({
  config: BemConfig,
  sources: String[],
  bemdecl: *,
  techs: String[],
  techsAliases: ?Object<String,String[]>
}): Stream<BemVinyl?>

class BemVynil extends Vynil {
  entity: BemEntity
}
@blond
Copy link
Member

blond commented Jul 17, 2016

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:

  1. The sources option is required.
  2. This API is more like a gulp.src()

@blond
Copy link
Member

blond commented Jul 17, 2016

The config option is not required. If this option is not specified we should find .bemrc file in project root.

@blond
Copy link
Member

blond commented Jul 17, 2016

Alse we should support gulp.src options: https://github.com/gulpjs/vinyl-fs#options

@blond
Copy link
Member

blond commented Jul 17, 2016

techsAliases: ?Object<String,String[]>

techsAliases -> techAliases?

@blond
Copy link
Member

blond commented Jul 17, 2016

class BemVynil extends Vynil {
  entity: BemEntity
}

I think we should use native Vynil.

@vithar
Copy link

vithar commented Jul 17, 2016

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.

@qfox
Copy link
Member Author

qfox commented Jul 18, 2016

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.

@blond
Copy link
Member

blond commented Jul 19, 2016

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.

@qfox
Copy link
Member Author

qfox commented Jul 19, 2016

I think we should support globs.

I think it's not blocking feature so we can do it later ;-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants