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 #356 from kristerkari/rule/at-import-partial-exten…
…sion Add at-import-partial-extension rule
- Loading branch information
Showing
4 changed files
with
540 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 |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# at-import-partial-extension | ||
|
||
Require or disallow extension in `@import` commands. | ||
|
||
```scss | ||
@import "file.scss"; | ||
/** ↑ | ||
* This extension */ | ||
``` | ||
|
||
The rule ignores [cases](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#import) when Sass considers an `@import` command just a plain CSS import: | ||
|
||
- If the file’s extension is `.css`. | ||
- If the filename begins with `http://` (or any other protocol). | ||
- If the filename is a `url()`. | ||
- If the `@import` has any media queries. | ||
|
||
## Options | ||
|
||
`string`: `"always"|"never"` | ||
|
||
### `"always"` | ||
|
||
The following patterns are considered warnings: | ||
|
||
```scss | ||
@import "foo"; | ||
``` | ||
|
||
```scss | ||
@import "path/fff"; | ||
``` | ||
|
||
```scss | ||
@import "path\\fff"; | ||
``` | ||
|
||
```scss | ||
@import "df/fff", "1.SCSS"; | ||
``` | ||
|
||
The following patterns are _not_ considered warnings: | ||
|
||
```scss | ||
@import "fff.scss"; | ||
``` | ||
|
||
```scss | ||
@import "path/fff.scss"; | ||
``` | ||
|
||
```scss | ||
@import url("path/_file.css"); /* has url(), so doesn't count as a partial @import */ | ||
``` | ||
|
||
```scss | ||
@import "file.css"; /* Has ".css" extension, so doesn't count as a partial @import */ | ||
``` | ||
|
||
```scss | ||
/* Both are URIs, so don't count as partial @imports */ | ||
@import "http://_file.scss"; | ||
@import "//_file.scss"; | ||
``` | ||
|
||
```scss | ||
@import "file.scss" screen; /* Has a media query, so doesn't count as a partial @import */ | ||
``` | ||
|
||
### `"never"` | ||
|
||
The following patterns are considered warnings: | ||
|
||
```scss | ||
@import "foo.scss"; | ||
``` | ||
|
||
```scss | ||
@import "path/fff.less"; | ||
``` | ||
|
||
```scss | ||
@import "path\\fff.ruthless"; | ||
``` | ||
|
||
```scss | ||
@import "df/fff", "1.SCSS"; | ||
``` | ||
|
||
The following patterns are _not_ considered warnings: | ||
|
||
```scss | ||
@import "foo"; | ||
``` | ||
|
||
```scss | ||
@import "path/fff"; | ||
``` | ||
|
||
```scss | ||
@import url("path/_file.css"); /* has url(), so doesn't count as a partial @import */ | ||
``` | ||
|
||
```scss | ||
@import "file.css"; /* Has ".css" extension, so doesn't count as a partial @import */ | ||
``` | ||
|
||
```scss | ||
/* Both are URIs, so don't count as partial @imports */ | ||
@import "http://_file.scss"; | ||
@import "//_file.scss"; | ||
``` | ||
|
||
```scss | ||
@import "file.scss" screen; /* Has a media query, so doesn't count as a partial @import */ | ||
``` |
Oops, something went wrong.