Getting prettier to work with Tailswind

Published at

#vscode

This TIL is more than a year old. Some details may have changed.

Getting Prettier to run was not easy. This seemed to do the trick.

.prettierrc

JSON
{
  "tailwindConfig": "./tailwind.config.js",
  "pluginSearchDirs": ["."],
  "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }],
  "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"]
}

settings.json

JSON
{
  "prettier.requireConfig": true,
  "prettier.documentSelectors": ["**/*.svelte"],
  "[svelte]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}