How to exclude files from Prettier glob pattern?

I have a hard time to exclude files from being formatted "on save" with Prettier using the glob pattern.

I want to exclude all files that contain the extension ".min."

foo.css (good)
foo.min.css (bad)

I tried this glob pattern:

{**/!(*.min),!(*.min)}.{js,ts,jsx,tsx,cjs,css}

 

Any idea?

1
2 comments

You can create a .prettierignore file that looks something like this:

*.min.*

in your project root folder

0

That works. Thank you so much, Elena.

0

Please sign in to leave a comment.