Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bem-config

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bem-config

Config module for bem-tools

  • 3.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
31
increased by47.62%
Maintainers
1
Weekly downloads
 
Created
Source

bem-config

Usage

var bemConfig = require('bem-config');
var optionalConfig = { plugins: { create: { techs: ['styl', 'browser.js'] } } };
var projectConfig = bemConfig(optionalConfig); // returns BemConfig instance

options

All options are optional:

  • name // base name for rc files. Default value is bem.
  • cwd // Default value is process.cwd().
  • defaults // extends found configs with this object
  • pathToConfig // custom path to config on FS
  • fsRoot // custom '/' directory
  • fsHome // custom $HOME directory
  • plugins // array of paths to plugings to require

Async API

get

var config = require('bem-config')();
config.get().then(function(conf) {
    console.log(conf); // config is a merge of CLI args + optionalConfig + all configs found by rc
});

level

var config = require('bem-config')();
config.level('path/to/level').then(function(levelConf) {
    console.log(levelConf); // merged level config
});

library

var config = require('bem-config')();
config.library('bem-components').then(function(libConf) {
    console.log(libConf); // library config
});

levelMap

var config = require('bem-config')();
config.levelMap().then(function(levelMap) {
    console.log(levelMap); // all levels hash with their options
});

module

var config = require('bem-config')();
config.module('bem-tools').then(function(bemToolsConf) {
    console.log(bemToolsConf); // merged config for required module
});

configs

var config = require('bem-config')();
config.configs().then(function(configs) {
    console.log(configs); // all found configs from all dirs
});

Sync API

getSync

var config = require('bem-config')();
var conf = config.getSync();
console.log(conf); // config is a merge of CLI args + optionalConfig + all configs found by rc

levelSync

var config = require('bem-config')();
var levelConf = config.levelSync('path/to/level');
console.log(levelConf); // merged level config

librarySync

var config = require('bem-config')();
var libConf = config.librarySync('bem-components');
console.log(libConf); // library config

levelMapSync

var config = require('bem-config')();
var levelMap = config.levelMapSync();
console.log(levelMap); // all levels hash with their options

moduleSync

var config = require('bem-config')();
var bemToolsConf = config.moduleSync('bem-tools')
console.log(bemToolsConf); // merged config for required module

configs

var config = require('bem-config')();
var configs = config.configs(true);
console.log(configs); // all found configs from all dirs

Config example

.bemrc:

{
    "root": true,
    "levels": {
        "path/to/level": {
            "scheme": "nested",
            "default": true
        }
    },
    "libs": {
        "libName": {
            "path": "path/to/lib"
        }
    },
    "sets": {
        "setName": ["level1", "level2"]
    },
    "modules": {
        "bem-tools": {
            "plugins": {
                "create": {
                    "techs": [
                        "css", "js"
                    ],
                    "templateFolder": "path/to/templates",
                    "templates": {
                        "js-ymodules": "path/to/templates/js"
                    },
                    "techsTemplates": {
                        "js": "js-ymodules"
                    },
                    "levels": {
                        "path/to/level": {
                            "techs": ["bemhtml.js", "trololo.olo"]
                        }
                    }
                }
            }
        },
        "bem-libs-site-data": {
            "someOption": "someValue"
        }
    }
}

levels override common options.

License

Code and documentation © 2015 YANDEX LLC. Code released under the Mozilla Public License 2.0.

Keywords

FAQs

Package last updated on 10 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc