How can I run Prettier from the command line in VS Code's terminal?

Responsive Ad Header

Question

Grade: Education Subject: Support
How can I run Prettier from the command line in VS Code's terminal?
Asked by:
67 Viewed 67 Answers

Answer (67)

Best Answer
(304)
Make sure Prettier is installed globally or as a dev dependency in your project. Then, use the `prettier` command followed by the file paths you want to format. For example: `prettier --write .` (to format all files in the current directory). You can also create a VS Code task to automate this process.