bbjsbeautify

Run js-beautify on BBEdit's frontmost text document. Based on isao/bbjshint

bbjsbeautify

Run js-beautify on the javascript code in your frontmost (and saved) BBEdit document, and to either replace the contents in the filesystem or see the results in a window.

Note that for now, BBEdit will tell you that the file was edited on the filesystem, and must be saved to retain the results from bbjsbeautify.

Use from BBEdit's Scripts menu by either installing or symlinking bbjsbeautify to BBEdit's Scripts folder. This is ~/Library/Application Support/BBEdit/Scripts or perhaps ~/Dropbox/Application Support/BBEdit/Scripts. You can show this folder from BBEdit by going to the scripts menu and choosing "Open Scripts Folder".

npm install --global bbjsbeautify
cd ~/Library/Application\ Support/BBEdit/Scripts
ln -s `which bbjsbeautify`

Please edit jsbeautify-opts.json to taste.

There are three script files to choose from and hotkey:

  • index.js relies opts.replace to decide if the results are written or displayed.
  • display.js will not write to file, but will show results in an output window.
  • replace.js will overwrite the file with the results.

Isao Yagi

See bbresults. and bbjshint.

MIT