Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.


How @bem/sdk.graph works?

node v10.24.1
version: 1.0.0
const { BemGraph } = require('@bem/sdk.graph'); const BemCell = require('@bem/sdk.cell'); const graph = new BemGraph(); // Create a vertices. graph.vertex({ block: 'a' }); graph.vertex({ block: 'b' }); graph.vertex({ block: 'c' }); graph.vertex({ block: 'd' }); // Define the dependencies between vertices. graph.vertex({ block: 'a' }) .linkWith({ block: 'b' }); graph.vertex({ block: 'c' }) .dependsOn({ block: 'd', mod: 'test'}) .dependsOn({ block: 'b'}, 'css'); // Naturalize graph if you want. It will add "natural" dependencies: // - element should depend on block; // - block modifier should depend on block; // - element modifier should depend on element. graph.naturalize(); // Set entities to create the dependencies list for. const cells = [ { block: 'c'}, { block: 'a'} ] // Get the dependencies list. graph.dependenciesOf(cells).map(c => BemCell.create(c).id).join('\n');

no comments

    sign in to comment