Unknown at rule @container scss(unknownAtRules)
Asked Answered
L

1

11

I hope it would be a simple question for you guys :(. I have a problem using container query by installing "container-query-polyfill". Of course, I enabled css container query flag from Chrome. In my container(parent) class, I add contain: inline-size; and for responsiveness, I add @container for child class as following.

 div.model-holdings-advanced-module {
 container: inline-size;
 @container size(max-width: sizing.$standard-tablet) {
 .table-component-wrapper {
  overflow-x: scroll;
  table.table-component {
    tr > :first-child {
      position: -webkit-sticky;
      position: sticky;
      left: 0;
      z-index: 999;
  }
 }
}
}

But it complains that container and @container is "Unknown at rule @container scss(unknownAtRules)". I check many tutorials, 100% of them use css, so I assumed that the problem might come from transforming scss to css. Since I am using Webpack, I did something like this

  mode: 'production',
  module: {
  rules: [
    {
      test: /\.m?jsx?$/,
      exclude: /(node_modules)/,
      loader: 'babel-loader',
      query: {
        presets: ['@babel/preset-env'], //Preset used for env setup
      },
    },
            {
      test: /\.s[ac]ss$/,
      use: [
        'raw-loader',
        {
          loader: 'sass-loader',
          options: {
            sassOptions: {
              includePaths: [path.resolve(__dirname, 'node_modules')],
            },
          },
        },
      ],
    },,
  ],
},

it didn't help at all. Now I am not sure if there is a problem coming from either using container query in scss, syntax error, or something else.

Leonelleonelle answered 3/3, 2022 at 23:22 Comment(0)
S
3

I think this is due the sass linter not yet updated with latest definitions for @container rules. This is not a syntax error, is just container queries aren't yet fully supported on all browsers.

You can add I think "scss.lint.unknownAtRules": "ignore". to ignore this kind of messages

Hope it helps

Strohl answered 5/1, 2023 at 10:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.