unknown at rule @include css(unknownAtRules) error while including @include in css file

Viewed 22562

I am trying to customize card columns by using Bootstrap 4 card layout. But why it is showing error if i am writing this code in my css file?

Error showing is in VS code: unknown at rule @include css(unknownatrules)

HTML file

<div class="card-columns">
  <div class="card" *ngFor="let item of vision">
    <div class="card-header">{{item.heading}}</div>
    <carousel [showIndicators]="false">
      <slide *ngFor="let item of vision">
        <img class="card-img-top embed-responsive embed-responsive-16by9" [src]="item.img" alt="vision image">
      </slide>
    </carousel>
  </div>
</div>

CSS file

.card-columns {
  @include media-breakpoint-only(md) {
    column-count: 3;
  }
  @include media-breakpoint-only(lg) {
    column-count: 4;
  }
}

4 Answers

If you use scss, than "scss.lint.unknownAtRules": "ignore".

The solution to this is almost always to install a plugin for your editor/IDE for PostCSS language support instead of regular CSS.

VS Code has a PostCSS Language Support plugin you can use that works great with morden CSS.

From this github issue, you need to add stylelint-scss to your devDependencies and in your .stylelintrc should have the following to turn off the warning.

{
  ...
  plugins: ["stylelint-scss"],
  "rules": {
    ...
    "at-rule-no-unknown": null,
    "scss/at-rule-no-unknown": true,
    ...
  }
}
Related