From 8cd14c78deb04f6ebad0150ccf1c19e70a1e9d45 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 | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/packages/config/README.md b/packages/config/README.md index 1c3b27fa..61ac89f6 100644 --- a/packages/config/README.md +++ b/packages/config/README.md @@ -2,6 +2,48 @@ ## 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 + +#### `SetConf` + +`string|Array` + +One of: +- single string with all used layers; e.g. `'bem-core@ common deskpad desktop'` +- list of layers; e.g. `[{library: 'bem-core'}, 'common', 'deskpad', 'desktop']` + +#### `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'] } } };