Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document API and make some usage examples #3

Open
qfox opened this issue Jul 25, 2016 · 1 comment
Open

Document API and make some usage examples #3

qfox opened this issue Jul 25, 2016 · 1 comment

Comments

@qfox
Copy link
Contributor

qfox commented Jul 25, 2016

We should document this primal object to show why it was separated out of the rest.

At least, there should be examples of usage:

const bundle = new BemBundle({path: ...});
@qfox
Copy link
Contributor Author

qfox commented Oct 15, 2016

const Bundle = require('@bem/bundle');

const bundle = new Bundle({path: './pages/index.bemjson.js'});
Bundle.isBundle(bundle); // true
bundle.bemjson; // {block: 'a', mods: {m: v}}
bundle.decl; // [{entity: {block: 'a'}, tech: null}, {entity: {block: 'a', mod: {name: m, val: v}, tech: null}]
bundle.name; // "index"
bundle.path; // "./pages/index.bemjson.js"
const intoStream = require('into-stream');
const Bundle = require('@bem/bundle');
const Builder = require('gulp-bem-bundle-builder');

const builder = new Builder({ /* ... */ });
intoStream([
  // Generating virtual bundles
  new Bundle({path: './pages/index.bemjson.js'}),
  new Bundle({path: './pages/page1.bemjson.js'}),
  new Bundle({path: './pages/page2.bemjson.js'})
])
.pipe(builder({ /* ... */ ));

@blond blond mentioned this issue Nov 25, 2016
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant