-
just a simple vue file like this:
It warning: but it does not warning if I place I had followed with the document: https://tailwindcss.com/docs/guides/vue-3-vite I do not want to see the warning line, and how to do? |
Beta Was this translation helpful? Give feedback.
Replies: 38 comments 143 replies
-
Has anyone solved this? I know this is not probably a tailwind issue but I would think that someone has solved this |
Beta Was this translation helpful? Give feedback.
-
Trick is to use the PostCSS language extension for VS Code usually: |
Beta Was this translation helpful? Give feedback.
-
UPDATE 2023 Here are the steps:
{
"css.customData": [".vscode/tailwind.json"]
}
{
"version": 1.1,
"atDirectives": [
{
"name": "@tailwind",
"description": "Use the `@tailwind` directive to insert Tailwind's `base`, `components`, `utilities` and `screens` styles into your CSS.",
"references": [
{
"name": "Tailwind Documentation",
"url": "https://tailwindcss.com/docs/functions-and-directives#tailwind"
}
]
},
{
"name": "@apply",
"description": "Use the `@apply` directive to inline any existing utility classes into your own custom CSS. This is useful when you find a common utility pattern in your HTML that you’d like to extract to a new component.",
"references": [
{
"name": "Tailwind Documentation",
"url": "https://tailwindcss.com/docs/functions-and-directives#apply"
}
]
},
{
"name": "@responsive",
"description": "You can generate responsive variants of your own classes by wrapping their definitions in the `@responsive` directive:\n```css\n@responsive {\n .alert {\n background-color: #E53E3E;\n }\n}\n```\n",
"references": [
{
"name": "Tailwind Documentation",
"url": "https://tailwindcss.com/docs/functions-and-directives#responsive"
}
]
},
{
"name": "@screen",
"description": "The `@screen` directive allows you to create media queries that reference your breakpoints by **name** instead of duplicating their values in your own CSS:\n```css\n@screen sm {\n /* ... */\n}\n```\n…gets transformed into this:\n```css\n@media (min-width: 640px) {\n /* ... */\n}\n```\n",
"references": [
{
"name": "Tailwind Documentation",
"url": "https://tailwindcss.com/docs/functions-and-directives#screen"
}
]
},
{
"name": "@variants",
"description": "Generate `hover`, `focus`, `active` and other **variants** of your own utilities by wrapping their definitions in the `@variants` directive:\n```css\n@variants hover, focus {\n .btn-brand {\n background-color: #3182CE;\n }\n}\n```\n",
"references": [
{
"name": "Tailwind Documentation",
"url": "https://tailwindcss.com/docs/functions-and-directives#variants"
}
]
}
]
} Credits: HISTORY For anyone in the future, if you are working in VSCode, you need to disable the lint rule of
here is how the file will look like in the case of .vscode > settings.json {
"scss.lint.unknownAtRules": "ignore"
} It helps you push the change in git and share the fix with the team. For Nuxt users, please add: SECOND WAY:
Usually, it fixes the issue right away, but you can reload browser if needed. Fix: For Update: |
Beta Was this translation helpful? Give feedback.
-
Thanks. It works for my Angular scss files. |
Beta Was this translation helpful? Give feedback.
-
Thank you @mrfambo , this is an amazing solution. |
Beta Was this translation helpful? Give feedback.
-
we can also add custom data example, in setting.json add and create a
custom data can also be added by extensions, so I would hope it gets added to Tailwind CSS IntelliSense extension. |
Beta Was this translation helpful? Give feedback.
-
Thank you the "css.lint.unknownAtRules": "ignore" in settings.json works perfectly! thank you. |
Beta Was this translation helpful? Give feedback.
-
For VueKeep in mind the type of i.e <style lang="scss">
.actions {
a{
@apply underline pr-2;
}
}
</style> As you can see above we have Note: if changes doesn't take effect immediately reload vs-code |
Beta Was this translation helpful? Give feedback.
-
fix, add lang in style, working me too. |
Beta Was this translation helpful? Give feedback.
-
The accepted solution didn't work for me in Nuxt 2. |
Beta Was this translation helpful? Give feedback.
-
"files.associations": {
"*.css": "postcss"
}, |
Beta Was this translation helpful? Give feedback.
-
The recommended fix is unacceptable and a workaround at best. Why disable all warnings when one wants to ignore a single case? As a Svelte user, @rowild's solution worked for me: I am now using |
Beta Was this translation helpful? Give feedback.
-
If you use VSCode, installing Tailwind CSS IntelliSense then VSCode settings: "files.associations": {
// "*.scss": "tailwindcss", // If you use .scss
"*.css": "tailwindcss"
} It is worked for me. |
Beta Was this translation helpful? Give feedback.
-
Unfortunately none of these recommendations (other than disabling unkownAtRules linting entirely, which feels a bit over the top) seem to work in .vue files. Changing the lang attribute to 'postcss' removes all highlighting, and the tailwind & postcss extensions don't seem to look in .vue files for rules. |
Beta Was this translation helpful? Give feedback.
-
Still no fix for Webstorm? |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
https://www.codeconcisely.com/posts/tailwind-css-unknown-at-rules/ |
Beta Was this translation helpful? Give feedback.
-
PHPStorm support? |
Beta Was this translation helpful? Give feedback.
-
Any "official" solution? |
Beta Was this translation helpful? Give feedback.
-
In 2024,I think the best solution is this: Install cpylua.language-postcss to fix it in vue,and change settings like below
don`t forget set style lang in vue file,then the highlight and format will be ok. |
Beta Was this translation helpful? Give feedback.
-
use vs code extension PostCSS Language Support |
Beta Was this translation helpful? Give feedback.
-
You can go to settings and type Unknown At Rules and select ignore |
Beta Was this translation helpful? Give feedback.
-
Actually, I made an extension named Tailwind CSS directives a while ago. I could have mentioned this earlier. https://marketplace.visualstudio.com/items?itemName=QuentiumYT.vscode-tailwindcss-directives It works with CSS / SCSS language server (not needed to switch to tailwindcss, or create extra configs |
Beta Was this translation helpful? Give feedback.
-
The best current solution is the |
Beta Was this translation helpful? Give feedback.
-
Still no fix for Webstorm? |
Beta Was this translation helpful? Give feedback.
-
For Lazyvim users, what worked for me was adding volar settings. Here is my config for disabling this rule everywhere. return {
"neovim/nvim-lspconfig",
opts = {
servers = {
tailwindcss = {
settings = {
tailwindCSS = {
lint = {
invalidApply = false,
},
},
},
},
cssls = {
settings = {
css = {
validate = true,
lint = {
unknownAtRules = "ignore",
},
},
scss = {
validate = true,
lint = {
unknownAtRules = "ignore",
},
},
},
},
volar = {
settings = {
css = {
validate = true,
lint = {
unknownAtRules = "ignore",
},
},
scss = {
validate = true,
lint = {
unknownAtRules = "ignore",
},
},
},
},
},
},
} |
Beta Was this translation helpful? Give feedback.
-
Until now, is there still no perfect solution to this problem in the Vue project? |
Beta Was this translation helpful? Give feedback.
-
Thanks it is working the way you explained. Great work buddy. |
Beta Was this translation helpful? Give feedback.
-
The accepted solution didn't work for me in Vue 3. Adding |
Beta Was this translation helpful? Give feedback.
UPDATE 2023
RECOMMENDED FIX:
Here are the steps:
.vscode
at the root of your project with the two files namedsettings.json
tailwind.json
settings.json
filetailwind.json
file