Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sass variable interpolation broken in an unknown at rule value #269

Open
MrSquaare opened this issue Mar 31, 2022 · 4 comments
Open

Sass variable interpolation broken in an unknown at rule value #269

MrSquaare opened this issue Mar 31, 2022 · 4 comments

Comments

@MrSquaare
Copy link

When using variable interpolation in an unknown at rule value, the sass linter reports false errors and the syntax is broken

Example:

$base: "black";

.text-base {
  @apply text-#{$base};
}

image

@praveenpuglia
Copy link
Contributor

I don't think @apply is a valid SCSS or CSS at-rule. It was once proposed but later abandoned for css. Can you tell me where you are getting this from?

@MrSquaare
Copy link
Author

@apply is an at-rule added by Tailwind CSS; it is not a standard CSS or SCSS at-rule
Today it is possible to ignore unknown at-rule via the unknownAtRules parameter, but the lint remains broken when using interpolation

@orimay
Copy link

orimay commented Jun 30, 2024

Any update on this?

@phatpcdev
Copy link

Hi guys,

You can try this approach:

  1. Create a file with the name tailwind.json in .vscode folder.
  2. Then, pass this JSON format below into tailwind.json file to tell vscode to be aware of the tailwind CSS at-rule. This is just a sample for @apply directive, you can do the same thing on another tailwind directive.
{
  "$schema": "https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/main/docs/customData.schema.json",
  "version": 1.1,
  "atDirectives": [
    {
      "name": "@apply",
      "description": "Use `@apply` to inline any existing utility classes into your own custom CSS.",
      "references": [
        {
          "name": "Tailwind Directives",
          "url": "https://tailwindcss.com/docs/functions-and-directives#apply"
        }
      ]
    }
  ]
}

  1. In .vscode/settings.json file, add more line:
{
...,
"css.customData": [".vscode/tailwind.json"]
...,
}
  1. Now, enjoy your coding time ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants