Formatting or beautifying javascript in SublimeText

The thread " Is there an HTML auto-indentation feature or plugin for Sublime Text (aka prettify/beautify/format)? " refers to an HTML formatter for SublimeText.
Does anyone know of something equivalent for javascript?

At the very least it needs to:

  • fix indentation
  • remove extra white spaces
  • remove extra blank lines

1 Answer

If you install Package Control and then use its search function you can find plugins for just about anything.

In this case, I'd recommend using HTML-CSS-JS Prettify. Make sure you have node.js installed and in your path, and make sure you read through the setup instructions carefully to get everything up and running. Other options include JSFormat, which doesn't require node, and JavaScript Beautify, which uses the same library as JSFormat but for some reason requires you to install it yourself.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like