-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from uberJeremy/deps.js-translation-draft-1
Deps.js translation
- Loading branch information
Showing
1 changed file
with
80 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,82 @@ | ||
# Syntax deps.js | ||
# The Syntax for `deps.js` | ||
|
||
This article is available only in Russian. | ||
## The complete implementation of the deps object: | ||
|
||
If you would like, you contribution in translating will be very much | ||
appreciated. Do not hesitate to [contact us](mailto:tadatuta@yandex-team.ru). | ||
```js | ||
{ | ||
block : 'bBlock', | ||
elem : 'elem', | ||
mod : 'modName', | ||
val : 'modValue', | ||
tech : 'techName', // file extention for this dependency (e.g. if javaScript `tech : '.js'`) | ||
mustDeps : [ ], // Array of blocks connected to this dependency | ||
shouldDeps : [ ], // The order of connected blocks is not important (important that they connect) | ||
noDeps : [ ], // It's possible to exclude some blocks, for example: `[ 'i-bem__dom_init_auto' ]` | ||
} | ||
``` | ||
|
||
## Notes to consider while constructing your deps.js for your project: | ||
|
||
### 1. Root `blocks` and `elements` start from naming a file, therefore it's optional to create the following file with the following data: | ||
|
||
For the file named: `b1.deps.js` write according to this pattern: | ||
|
||
```js | ||
({ | ||
block : 'b1', | ||
mustDeps : { block : 'b2' } | ||
}) | ||
|
||
({ | ||
mustDeps : { block : 'b2' } | ||
}) | ||
``` | ||
|
||
### 2. `elem` includes **only** the `element` (but not the block itself): | ||
|
||
```js | ||
{ block : 'b1', elem : 'e1' } | ||
``` | ||
|
||
This is comparable to `mod` and `val`. | ||
|
||
### 3. `elems` — This is a shortcut, which allows you to connect to several elements for blocks a **from the same block** | ||
|
||
```js | ||
{ block : 'b1', elems : ['e1', 'e2'] } | ||
``` | ||
|
||
Or, like this: | ||
|
||
```js | ||
{ | ||
block : 'b1', | ||
elems : [ | ||
{ elem : 'e1' }, | ||
{ elem : 'e2', mod : 'modName' }, | ||
{ elem : 'e3', mods : { modName : modVal } | ||
] | ||
} | ||
``` | ||
<!--(Begin) Article author block--> | ||
<div class="article-author"> | ||
<div class="article-author__photo"> | ||
<img class="article-author__pictures" src="http://img-fotki.yandex.ru/get/6434/51437929.0/0_bfef0_5d9cdb30_M.jpg" alt="Фотография Владимира Варанкина"> | ||
</div> | ||
<div class="article-author__info"> | ||
<div class="article-author__row"> | ||
<span class="article-author__name">Vladimir Varankin (Владимир Варанкин), | ||
</div> | ||
<div class="article-author__row"> | ||
Team Leader of the Interface Designers in Yandex (Ведущий разработчик интерфейсов в Яндексе) | ||
</div> | ||
<div class="article-author__row"> | ||
<a class="article-author__social-icon b-link" target="_blank" href="http://twitter.com/tvii">twitter.com/tvii</a> | ||
</div> | ||
<div class="article-author__row"> | ||
<a class="article-author__social-icon b-link" target="_blank" href="http://github.com/narqo">github.com/narqo</a> | ||
</div> | ||
</div> | ||
</div> | ||
<!--(End) Article author block--> |