Would you like to clone this notebook?

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

Cancel

@bem/sdk.deps: gather()

node v10.24.1
version: 1.0.1
endpointsharetweet
const deps = require('@bem/sdk.deps'); const mockfs = require('mock-fs'); const { stripIndent } = require('common-tags'); // Describe a file structure of the project. This is a simplified bem-express structure. mockfs({ '.bemrc': stripIndent` module.exports = { root: true, levels: [ { naming: 'legacy', layer: 'common', path: 'common.blocks' }, { naming: 'legacy', layer: 'development', path: 'development.blocks' } ], sets: { 'desktop': 'common', 'development': 'common development' } }`, 'common.blocks': { 'page': { 'page.deps.js': stripIndent` ({ shouldDeps: [ { mods: { view: ['404'] } }, 'header', 'body', 'footer' ]})` }, 'header': { 'header.deps.js': '({ shouldDeps: ["logo"] })' }, }, 'development.blocks': { 'page': { 'page.deps.js': '({ shouldDeps: ["livereload"] })' } } }); // Load `deps.js` files for the default platform (`desktop`). const commonFiles = await deps.gather({ });
// Show the file paths in a readable format. commonFiles.map(f => f.path);
Gather files for the `development` platform that include `common` and `development` layers.
platform = 'development' const developmentFiles = await deps.gather({ platform }); developmentFiles.map(f => f.path);
Loading…

no comments

    sign in to comment