Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hudochenkov committed Jan 11, 2017
1 parent 12d97c0 commit 541a741
Show file tree
Hide file tree
Showing 11 changed files with 2,254 additions and 524 deletions.
551 changes: 27 additions & 524 deletions README.md

Large diffs are not rendered by default.

338 changes: 338 additions & 0 deletions docs/at-rule-nested-empty-line-before.md
@@ -0,0 +1,338 @@
# at-rule-nested-empty-line-before

Specify an empty line before nested at-rules.

## Primary option

`boolean`: `true|false`

### `true`

There *must always* be an empty line before at-rules.

Before:

```css
div {
a {}
@media {}
}
```

After:

```css
div {
a {}

@media {}
}
```

### `false`

There *must never* be an empty line before at-rules.

Before:

```css
div {
a {}

@media {}
}
```

After:

```css
div {
a {}
@media {}
}
```

## Optional secondary options

```js
[
"<primary option>",
{
except: ["after-same-name", "blockless-after-blockless", "blockless-after-same-name-blockless", "first-nested"],
ignore: ["after-comment", "blockless-after-blockless", "blockless-after-same-name-blockless"],
ignoreAtRules: ["array", "of", "at-rules"]
}
]
```

### `except: ["after-same-name", "blockless-after-same-name-blockless", "blockless-after-blockless", "first-nested"]`

#### `"after-same-name"`

Reverse the primary option for at-rules that follow another at-rule with the same name.

This means that you can group your at-rules by name.

Given:

```js
[true, { except: ["after-same-name"] }]
```

Before:

```scss
a {
@extends .foo;
@extends .bar;
@include x;
@include y {}
}
```

After:

```scss
a {

@extends .foo;
@extends .bar;

@include x;
@include y {}
}
```

#### `"blockless-after-same-name-blockless"`

Reverse the primary option for blockless at-rules that follow another blockless at-rule with the same name.

This means that you can group your blockless at-rules by name.

Given:

```js
[true, { except: ["blockless-after-same-name-blockless"] }]
```

Before:

```css
a {
@extends .foo;
@extends .bar;
@include loop;
@include doo;
}
```

After:

```css
a {

@extends .foo;
@extends .bar;

@include loop;
@include doo;
}
```

#### `"blockless-after-blockless"`

Reverse the primary option for blockless at-rules that follow another blockless at-rule.

Given:

```js
[true, { except: ["blockless-after-blockless"] }]
```

Before:

```css
a {
@import url(x.css);

@import url(y.css);

@media print {}
}
```

After:

```css
a {

@import url(x.css);
@import url(y.css);

@media print {}
}
```

#### `"first-nested"`

Reverse the primary option for at-rules that are the first child of their parent node.

Given:

```js
[true, { except: ["blockless-after-blockless"] }]
```

Before:

```css
a {

@extend foo;
color: pink;
}

b {
color: pink;
@extend foo;
}
```

After:

```css
a {
@extend foo;
color: pink;
}

b {
color: pink;

@extend foo;
}
```

### `ignore: ["after-comment", "blockless-after-blockless", "blockless-after-same-name-blockless"]`

#### `"after-comment"`

Ignore at-rules that come after a comment.

Given:

```js
[true, { ignore: ["after-comment"] }]
```

```css
a {
/* comment */
@media {}
}
```

```css
a {
/* comment */

@media {}
}
```

#### `"blockless-after-same-name-blockless"`

Ignore blockless at-rules that follow another blockless at-rule with the same name.

This means that you can group your blockless at-rules by name.

Given:

```js
[true, { ignore: ["blockless-after-same-name-blockless"] }]
```

```css
a {

@extends .foo;
@extends .bar;

@include loop;
@include doo;
}
```

```css
a {

@extends .foo;

@extends .bar;

@include loop;

@include doo;
}
```

#### `"blockless-after-blockless"`

Ignore blockless at-rules that follow another blockless at-rule.

Given:

```js
[true, { ignore: ["blockless-after-blockless"] }]
```

```css
a {

@import url(x.css);

@import url(y.css);

@media print {}
}
```

```css
a {

@import url(x.css);
@import url(y.css);

@media print {}
}
```

### `ignoreAtRules: ["array", "of", "at-rules"]`

Ignore specified at-rules.

Given:

```js
[true, { ignoreAtRules: ["import"] }]
```

```css
a {

@if (true) {
}

@else {
}
}
```

```css
a {

@if (true) {
} @else {
}
}
```
58 changes: 58 additions & 0 deletions docs/clean-empty-lines.md
@@ -0,0 +1,58 @@
# clean-empty-lines

Remove all empty lines. Runs before all other rules.

`boolean`: `true|false`

By default it's disabled.

Given:

```js
{ 'clean-empty-lines': true }
```

Before:

```css
a {


/* comment 3 */



display: block;


position: absolute;
top: 100%;
right: 50%;
@extend .something;


@mixin hiya {
display: none;
}
@include hello;


}
```

After:

```css
a {
/* comment 3 */
display: block;
position: absolute;
top: 100%;
right: 50%;
@extend .something;
@mixin hiya {
display: none;
}
@include hello;
}
```

0 comments on commit 541a741

Please sign in to comment.