Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Latest commit 4aab846 @narqo narqo Update README
Fix typo in JSDoc
Failed to load latest commit information.
lib Update README
.jshintrc .jshintrc added 1.4.0 Update README


NPM version


Install it with npm

› npm install bem-environ --save

If you plan to distribute your module/library as an npm package, add bem-environ to bundledDependencies section (see example) in your package.json. This is due to every BEM library need its own copy of bem-environ, but npm tries to optimise packages installation.

    "bundledDependencies": ["bem-environ"]

Update your project's make.js to extend common build process provided by bem-tools

// make.js

// Initialize environ with global root path (see API section for more examples)
var environ = require('bem-environ')(__dirname);

function extendMake(registry) {

    // Extend common `bem make` build process with `bem-environ`'s nodes (optional)

    registry.decl('Arch', {

      // ...



// For compatibility with bem-tools << 1.0.0
if (MAKE) extendMake(MAKE);

// For compatibility with bem-tools >= 1.0.0
if (module && module.exports) module.exports = extendMake;


environ(root | opts)

{String|Object} root | opts — Options to declare or path to the environment root

Set environment root and other options.


Set environment root only:

var environ = require('bem-environ')(__dirname);

Set environment root and other options:

var environ = require('bem-environ')({
    root: __dirname,
    libDir: 'components', // override default 'libs' directory
    confDir: 'conf' // override default 'configs' directory


{BEM.Registry} registry — bem-tools registry object

Extend bem-tools registry object with nodes of bem-environ.

getLibPath(lib, [path...])

{String} lib — Library name {String} path... — Library internal path

Return absolute path to the library root or its files or directories.

getLibRelPath(lib, [path...])

{String} lib — Library name {String} path... — Library internal path

Return relative to the root path to the library root or its files or directories.


getTechResolver(techs, prefix)

{Object} techs – Tech rgistry to fulfill {String} prefix – Path to resolve from

Returns resolver function to fulfill registry techs with tech modules according to specified path prefix

// level.js
var getTechResolver = require('environ').getTechResolver;

exports.getTechs = function() {
    var techs = {};

    ['css', 'js', 'bemhtml'].forEach(
        getTechResolver(techs, '<path/to/bem-core>/.bem/techs'));

    return techs;
Something went wrong with that request. Please try again.