EN RU
Forum

Methodology

Technology

Toolbox

Libraries

Tutorials

Building a distribution

A distribution is a set of bundles. Each bundle is a build of all BEM entities for a project platform.

dist/
├── desktop/
├── touch-phone/
└── touch-pad/

To learn how to build a bundle, read Building a bundle.

Example of a distribution build

The project consists of three platforms:

Project file system:

.enb/
└── make.js          # The ENB config file
common.blocks/       # common level
desktop.blocks/      # desktop level
touch.blocks/        # common level for touch interfaces
touch-phone.blocks/  # touch pad level
touch-pad.blocks/    # touch phones level

To build a distribution from css and js for each platform, you need to:

module.exports = function (config) { platforms.forEach(function(platform) { var node = path.join('dist', platform);

    // Configure a distribution build for a certain platform.
    // The `config.node` method creates the `dist/platform-name` directory,
    // if it doesn't exist yet.
    config.node(node, function(nodeConfig) {
        nodeConfig.addTechs([
            [techs.levels, {
                levels: levels[platform]  // (1) -> `?.levels`
            }],
            [techs.levelsToBemdecl],      // (2) `?.levels` -> `?.bemdecl.js`
            [techs.deps],                 // (3) `?.bemdecl.js` -> `?.deps.js`
            [techs.files],                // (4) `?.levels` + `?.deps.js` -> `?.files`

            [css],
            [js]
        ]);

        nodeConfig.addTargets(['?.css', '?.js']);
    }
}

};

6. Launch the build in the console:

```sh
$ enb make

You can build other necessary bundles in the same way, such as bundles of templates.