stylelint-scss
Version:
A collection of SCSS specific rules for stylelint
70 lines (51 loc) • 1.51 kB
Markdown
# partial-no-import
Disallow non-CSS ``s in partial files.
```scss
// path/to/_file.scss:
/* ↑ in partial files */
"path/to/file.scss"
/*↑ Disallow imports */
```
The rule skips CSS files (doesn't report any ``s in them).
The rule also 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 `` has any media queries.
The following patterns are considered warnings:
```scss
// path/to/_file.scss:
"foo.scss";
```
```scss
// path/to/_file.less:
"path/fff.less";
```
```scss
// path/to/_file.scss:
"path\\fff.supa";
```
The following patterns are *not* considered warnings:
```scss
// path/to/file.scss:
"path/fff";
/* @import in a file that is not a partial */
```
```scss
// path/to/_file.scss:
url("path/_file.css"); /* has url(), so doesn't count as a partial @import */
```
```scss
// path/to/_file.scss:
"file.css"; /* Has ".css" extension, so doesn't count as a partial @import */
```
```scss
// path/to/_file.scss:
"http://_file.scss";
"//_file.scss";
/* Both are URIs, so don't count as partial @imports */
```
```scss
// path/to/_file.scss:
"file.scss" screen; /* Has a media query, so doesn't count as a partial @import */
```