1

I use VS Code for custom css I write in WordPress to have version control on it and when VS Code runs formatOnSave (which I generally love) in the CSS files, it inserts a space before !important, which when you're writing CSS over WordPress themes and page builders... is a must.

For example, it will change padding-bottom: 0px!important; to padding-bottom: 0px !important; which in some contexts (in particular in WordPress), will break it.

Is there a way to disable just this or customize just this? The rest of the formatting I very much like.

Thank you in advance!

blubberbo
  • 4,441
  • 4
  • 23
  • 36

1 Answers1

0

Hey what you can do is add comments into your File which will disable prettier for a bunch of different reasons.

You can have prettier just not run full stop for a file: Disable prettier for a single file

But also you can dig deeper into the documentation and ignore certain lines, even adding in a ruleset:

https://glebbahmutov.com/blog/configure-prettier-in-vscode/

Also you can setup custom rulesets which might be helpful for you:

How to make Prettier to ignore a block of code?

Sweet Chilly Philly
  • 3,014
  • 2
  • 27
  • 37