Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/zgabievi/bem
Browse files Browse the repository at this point in the history
  • Loading branch information
Zura Gabievi committed Sep 4, 2015
2 parents cd67292 + 409f88e commit c5cdb33
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 230 deletions.
14 changes: 14 additions & 0 deletions Documentation.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Documentation

+ [Mixins](https://github.com/zgabievi/bem/blob/master/Documentation.md#mixins)
- [Block](https://github.com/zgabievi/bem/blob/master/Documentation.md#block-mixin)
- [Element](https://github.com/zgabievi/bem/blob/master/Documentation.md#element-mixin)
- [Modifier](https://github.com/zgabievi/bem/blob/master/Documentation.md#modifier-mixin)
- [Relations](https://github.com/zgabievi/bem/blob/master/Documentation.md#relations)
- [States](https://github.com/zgabievi/bem/blob/master/Documentation.md#states)
- [Pseudo Element](https://github.com/zgabievi/bem/blob/master/Documentation.md#pseudo-elements)
+ [Functions](https://github.com/zgabievi/bem/blob/master/Documentation.md#functions)
- [bem-index()](https://github.com/zgabievi/bem/blob/master/Documentation.md#bem-index)
- [get-block()](https://github.com/zgabievi/bem/blob/master/Documentation.md#get-block)
- [is-block()](https://github.com/zgabievi/bem/blob/master/Documentation.md#is-block)
- [is-element()](https://github.com/zgabievi/bem/blob/master/Documentation.md#is-element)
- [is-modifier()](https://github.com/zgabievi/bem/blob/master/Documentation.md#is-modifier)

## Mixins

### Block mixin:
Expand Down
243 changes: 13 additions & 230 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,236 +32,19 @@ for `sass` syntax:

## Documentation

+ [Mixins](https://github.com/zgabievi/bem/blob/master/README.md#mixins)
- [Block](https://github.com/zgabievi/bem/blob/master/README.md#block-mixin)
- [Element](https://github.com/zgabievi/bem/blob/master/README.md#element-mixin)
- [Modifier](https://github.com/zgabievi/bem/blob/master/README.md#modifier-mixin)
- [Relations](https://github.com/zgabievi/bem/blob/master/README.md#relations)
- [States](https://github.com/zgabievi/bem/blob/master/README.md#states)
- [Pseudo Element](https://github.com/zgabievi/bem/blob/master/README.md#pseudo-elements)
+ [Functions](https://github.com/zgabievi/bem/blob/master/README.md#functions)
- [bem-index()](https://github.com/zgabievi/bem/blob/master/README.md#bem-index)
- [get-block()](https://github.com/zgabievi/bem/blob/master/README.md#get-block)
- [is-block()](https://github.com/zgabievi/bem/blob/master/README.md#is-block)
- [is-element()](https://github.com/zgabievi/bem/blob/master/README.md#is-element)
- [is-modifier()](https://github.com/zgabievi/bem/blob/master/README.md#is-modifier)

### Mixins
#### Block mixin:
```scss
@include b(list) {
list-style-type: disc;
}
```
> You can use `@include block(...) {...}` too
CSS Output:
```css
.list {
list-style-type: disc;
}
```
---
#### Element mixin:
```scss
@include b(list) {
list-style-type: disc;

@include e(item) {
padding: 0.5em 1em;
}
}
```
> You can use `@include element(...) {...}` too
CSS Output:
```css
.list {
list-style-type: disc;
}

.list__item {
padding: 0.5em 1em;
}
```
---
#### Modifier mixin:
```scss
@include b(list) {
list-style-type: disc;

@include m(ordered) {
list-style-type: decimal;
}
}
```
> You can use `@include modifier(...) {...}` too
CSS Output:
```css
.list {
list-style-type: disc;
}

.list--ordered {
list-style-type: decimal;
}
```
---
#### Relations
```scss
@include b(list) {
list-style-type: disc;

@include e(item) {
padding: 0.5em 1em;

@include at(ordered) {
padding: 1em;
}

@include duo {
margin-left: 10px;
}

@include with(element) {
margin-left: 5px;
}
}
}
```
CSS Output:
```css
.list {
list-style-type: disc;
}

.list__item {
padding: 0.5em 1em;
}

.list--ordered .list__item {
padding: 1em;
}

.list__item + .list__item {
margin-left: 10px;
}

.list__item + .list__element {
margin-left: 5px;
}
```
----
#### States
```scss
a {

@include is(active) {
font-weight: bold;
}

@include hover {
color: red;
}

@include focus {
color: blue;
}

@include active {
color: green;
}
}
```
CSS Output:
```css
a.is-active {
font-weight: bold;
}

a:hover {
color: red;
}

a:focus {
color: blue;
}

a:active {
color: green;
}
```
---
#### Pseudo Elements
```scss
a {
@include first {
color: orange;
}

@include last {
color: blue;
}

@include even {
color: green;
}

@include odd {
color: aqua;
}
}
```
CSS Output:
```css
a:first-child {
color: orange;
}

a:last-child {
color: blue;
}

a:nth-child(even) {
color: green;
}

a:nth-child(odd) {
color: aqua;
}
```
### Functions
#### bem-index()
```scss
bem-index(list__item); // @returns '5'
bem-index(navbar--inverse); // @returns '7'
bem-index(form); // @returns '0'
```
#### get-block()
```scss
get-block('.list__item'); // @returns 'list'
get-block('.navbar--inverse'); // @returns 'navbar'
get-block('.form'); // @returns 'form'
```
#### is-block()
```scss
is-block('.list__item'); // @returns false
is-block('.navbar--inverse'); // @returns false
is-block('.form'); // @returns true
```
#### is-element()
```scss
is-element('.list__item'); // @returns true
is-element('.navbar--inverse'); // @returns false
is-element('.form'); // @returns false
```
#### is-modifier()
```scss
is-element('.list__item'); // @returns false
is-element('.navbar--inverse'); // @returns true
is-element('.form'); // @returns false
```
+ [Mixins](https://github.com/zgabievi/bem/blob/master/Documentation.md#mixins)
- [Block](https://github.com/zgabievi/bem/blob/master/Documentation.md#block-mixin)
- [Element](https://github.com/zgabievi/bem/blob/master/Documentation.md#element-mixin)
- [Modifier](https://github.com/zgabievi/bem/blob/master/Documentation.md#modifier-mixin)
- [Relations](https://github.com/zgabievi/bem/blob/master/Documentation.md#relations)
- [States](https://github.com/zgabievi/bem/blob/master/Documentation.md#states)
- [Pseudo Element](https://github.com/zgabievi/bem/blob/master/Documentation.md#pseudo-elements)
+ [Functions](https://github.com/zgabievi/bem/blob/master/Documentation.md#functions)
- [bem-index()](https://github.com/zgabievi/bem/blob/master/Documentation.md#bem-index)
- [get-block()](https://github.com/zgabievi/bem/blob/master/Documentation.md#get-block)
- [is-block()](https://github.com/zgabievi/bem/blob/master/Documentation.md#is-block)
- [is-element()](https://github.com/zgabievi/bem/blob/master/Documentation.md#is-element)
- [is-modifier()](https://github.com/zgabievi/bem/blob/master/Documentation.md#is-modifier)

## License
The BEM package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

0 comments on commit c5cdb33

Please sign in to comment.