How to batch Beautify/Prettify/Unminify all HTML files in a folder? - XML Tools Plugin - Pretty Print - Apply to all open documents - Find In Files
-
I have about 1000 html files I need to beautfy/prettify/unminify.
I found the XML Tools Plugin which has a Pretty Print menu option and Apply to all open documents feature, but it is unpractical to open 1000s of files before processing.
Is there a similar tool that can prompt to open the target folder and process all the files in the folder instead of needing to open all the files first (like the Find In Files feature)?
-
Is there a similar tool
Yes, I am quite certain that there exist multiple command-line utilities which can provide a “pretty print” functionality similar to what XML Tools plugin brings, and should be able to work on multiple files in a directory (or recursively).
But Notepad++ itself wasn’t designed to be a generic “transform bulk files with no interaction” – its primary purpose is dealing with files opened for editing inside the application.
As such, most plugins written for Notepad++ also maintain that philosophy, again focussing on the open files, rather than being able to do batch processing on unopened files.
That said, just like the N++ developer was able to make an exception where he decided that being able to apply the same regex to a bunch of unopened files would be useful, a plugin developer might be willing to add such a feature, if they were asked and were interested. However, I don’t believe XML Tools has that feature, and that project (under the original owner) hasn’t had any updates in 2 years, so it might be that the owner is no longer interested, so my guess is no new features will be added to XML Tools anytime soon (unless someone releases their fork of the project). And I don’t know of any plugins that have XML prettification, so it’s doubtful there’s another plugin that has a bulk/batch version of that feature.
One could use a scripting plugin (like PythonScript) and have the script iterate through each of the 1000 files, to do {open the file, run the plugin’s prettification, save, and close the file} on each file. That’s not that hard to do in PythonScript (though it would be easier, I think, to find a stand-alone command-line tool that prettifies XML, and just run that).
-
@PeterJones Thanks for the input.
Surprisingly, just dragging and dropping all the files at once onto Notepad++ opens all the files in about 5 seconds for 1000 files.
Then the XML Tools takes about 10 seconds to prettify all opened files.
Then just go to File > Close All so to not have to close each file manually.
Will do it that way.
Would be great to update the XML tools plugin if someone’s able and it is not to much work.
Or just adding the Pretty Print feature directly to the Find In Files feature as extra function for the next Notepad++ update.