Code Monkey home page Code Monkey logo

bem-config's Introduction

bem-config

Usage

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

options

All options are optional:

  • name // 'bem'
  • projectRoot // process.cwd()
  • config // extends found configs with this object
  • argv // custom path to config on FS via command line argument --config (defaults to null)

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

{
    "root": true,
    "levels": {
        "path/to/level": {
            "scheme": "nested"
        }
    },
    "libs": {
        "libName": {
            "path": "path/to/lib"
        }
    },
    "sets": {
        "setName": ["level1", "level2"]
    },
    "modules": {
        "bem-tools": {
            "plugins": {
                "create": {
                    "techs": [
                        "css", "js"
                    ],
                    "templateFolder": "/Users/tadatuta/Sites/bem/bem-tools-create/templates",
                    "templates": {
                        "js-ymodules": "/Users/tadatuta/Sites/bem/bem-tools-create/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.

bem-config's People

Contributors

tadatuta avatar tormozz48 avatar vithar avatar voischev avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.