-
Notifications
You must be signed in to change notification settings - Fork 24
config: describe the main fields #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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<LevelConf>` | List of known levels in the right order<br> (usually local) with their configurations | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feels like we don't need the difference between levels and libraries — in all cases they are the same. Let's drop this field in favor of If we need to configure some directory (originally levels) with additional fields we should convert them to libraries and define in So:
|
||
| sets | `Object<string, SetConf>` | Named sets of layers to use in projects | ||
|
||
| libs | `Object<string, LibraryConf>` | Dependency libraries to use in sets | ||
| plugins | `Object<string, PluginConf>` | Various configurations for plugins,<br>can be reached via [`.module`](#module) method | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reference "how/where |
||
|
|
||
| #### `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 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is default value here? Root
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Guess, it should be |
||
| - `path` - optional. required for legacy way, unwanted for the modern one | ||
| - the rest fields will have passed to level config | ||
|
||
|
|
||
| #### `SetConf` | ||
|
|
||
| `string|Array<string|{library: string, set?: string}>` | ||
|
|
||
| One of: | ||
| - single string with all used layers; e.g. `'bem-core@ common deskpad desktop'` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mistake. Right form is |
||
| - list of layers and/or libraries and library sets; e.g. `[{library: 'bem-core'}, 'common', 'deskpad', 'desktop']` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add variant with library and set in one item
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually, if set is undefined then the current one will be used by default.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your definition "if set is undefined then the current one will is used by default" is okey. Write more short sentences
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this version we missed
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "targets specific layer in library" |
||
|
|
||
| #### `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'] } } }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this? May be with an example