@bem/sdk.deps: gather()

node v10.17.0
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