- First, install the js-beautify program. Here I posted instructions how to install it on Windows.
- Download and install NppExec for Notepad++, get it here
- Install NppExec by putting the DLL file into Notepad++'s plugins folder. Then restart Notepad++ to finish the installation.
- In Notepad++, open the plugins menu, select NppExec, then select Execute.
- Add the following code:
NPE_CONSOLE v+ set NODE = $(SYS.PROGRAMFILES)\nodejs\node.exe set JSBEAUTIFY = $(SYS.APPDATA)\npm\node_modules\js-beautify\bin\html-beautify.js set INPUTFILE = $(SYS.TEMP)\npp_sel.txt SEL_SAVETO $(INPUTFILE) :a $(NODE) "$(JSBEAUTIFY)" -t -f "$(INPUTFILE)" SEL_SETTEXT $(OUTPUT) NPE_CONSOLE v-
- After you pasted the code, save the script and click cancel.
- Select some text in your document (or press CTRL+A to select all text), press F6 to bring up NppExec's execute dialog, and press OK to run the script you just created. The selected text should now be replaced with the output of html-beautify.
Monday, April 8, 2013
Run js-beautify, css-beautify and html-beautify from Notepad++