Format on Save with Prettier

This is a quick tutorial on how to setup VSCode to format on save using the Prettier extension, including formatting HTML.

Install the Prettier Extension
Select ‘Settings’ from the gear icon in the lower left corner of VSCode
In the search bar type ‘forma’ to look for format and choose Prettier as your default formatter and turn on format on save
Select ‘Command Palette’ from the gear icon in the lower right hand corner of VSCode
In the search bar type ‘settings’ and select the ‘Preferences: Open Settings (JSON)
Add the new line to the JSON.

This part is probably the hardest part. VSCode will help you though by trying to auto complete the right line of code. Be sure to add a comma at the end of the line before this new line.

Published
Categorized as Posts

By Michael Branson Smith

Michael Smith is an Assistant Professor and Director of the Communications Technology program at York College. Prof. Smith hosts a personal digital archive project blog on Commons titled It Cannot Be Trivial.

Leave a comment

Your email address will not be published. Required fields are marked *