Suppressing Tailwind CSS "Unknown At Rule" Warnings in Neovim

Working with Tailwind CSS in Neovim and want to get rid of unknown at rule warnings? If you're using LazyVim, you can easily suppress these warnings by adjusting the CSS language server settings in a Lua plugin file.

Quick Setup

  1. Create a Lua Plugin File: If you don't have one, make a file in ~/.config/nvim/lua/plugins/ named nvim-lspconfig.lua.

  2. Adjust CSS LSP Settings: Add the following code to your Lua plugin file. This tells the CSS language server to ignore unknown at rule warnings.

return {
  "neovim/nvim-lspconfig",
  opts = {
    servers = {
      cssls = {
        settings = {
          css = {
            lint = {
              unknownAtRules = "ignore",
            },
          },
        },
      },
    },
  },
}
  1. Reload Neovim: Apply the changes by reloading Neovim.

Done! Your Neovim will now ignore unknown at rule warnings from Tailwind. Rejoice in the peace and quiet.

Sidenote: If you're using VSCode, you can suppress these warnings by installing the Tailwind CSS IntelliSense extension along with the PostCSS Language Support extension.

Reference: Tailwind CSS docs