From 4dbb567e61612e6352a456d687de15f28b8213cd Mon Sep 17 00:00:00 2001 From: Alexey Yaroshevich Date: Tue, 13 Feb 2018 11:07:36 +0300 Subject: [PATCH] docs(config): describe the primary set of fields in .bemrc --- packages/config/README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/packages/config/README.md b/packages/config/README.md index 1c3b27fa..0a4042b6 100644 --- a/packages/config/README.md +++ b/packages/config/README.md @@ -2,6 +2,40 @@ ## Usage +### `.bemrc` fields + +Field | Type | Purpose +--- | --- | --- +root | `Boolean` | Used to determine the root directory from the current one +naming | `string|Object` | Name of existing in [`naming.preset`](https://github.com/bem/bem-sdk/tree/master/packages/naming.presets) preset or custom definition +levels | `Array` | List of known levels (usually local)
in the right order with their configurations +sets | `Object>` | Named sets of layers to use in projects +libs | `Object` | Dependency libraries to use in sets +plugins | `Object` | Various configurations for plugins, can be reached via [`.module`](#module) method + +#### `LevelConf` + +Describes level with sources. +In classic version it represents a directory for a single layer — e.g. `bem-components/common.blocks/` for `common` or `bem-components/desktop.blocks/` for `desktop`. +In modern version represents a set of layers relative to library path (`.bemrc` location) +and depends on naming preset — e.g. `common` and `desktop` for just `bem-components/` (library) path and [`origin`](https://github.com/bem/bem-sdk/blob/master/packages/naming.presets/origin.js) preset. + +- `layer` - name of level‘s layer to use in sets +- `naming` - naming preset for this level +- `path` - optional. required for legacy way, unwanted for the modern one +- the rest fields will have passed to level config + +#### `LibraryConf` + +- `path` - to library which should better contain their own `.bemrc` file with their own sets +- the rest fields will have passed to library config and extend `.bemrc` config found at `${path}/.bemrc` + +#### `PluginConf` + +- all the fields will have passed directly to plugins + +## API + ```js const bemConfig = require('@bem/sdk.config'); const optionalConfig = { plugins: { create: { techs: ['styl', 'browser.js'] } } };