THIS IS AWESOME !!!!!!!!!!!!

Blog.

Running Prettier From The Terminal

Ian Izaguirre
Ian Izaguirre
Cover Image for Running Prettier From The Terminal
Ian Izaguirre
Ian Izaguirre

If you do not have prettier installed globally, we can add it using yarn.

yarn global add prettier

We can run Prettier against a file we want to format by just using the terminal. For example, if we run this:

prettier --single-quote --print-width=120 FilesName.js
test.js

Our terminal will show us what the file would look like formatted, but it will not actually format the actual file for us. If we want to format the actual file, we would have to include --write in our command, before the filename. So we would run:

prettier --single-quote --print-width=120 --write FilesName.js