-
Notifications
You must be signed in to change notification settings - Fork 428
[Question] How to use tidy for multiple files? #668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@Kristinita you are correct console
But that would be a very long command line if you have more than 100 files... and in Windows there may be some limit of the maximum command line... but should work... Alternatively, since you appear to be in windows, why not write a batch file, using Or you could make a list file of all html files, like Then again use a batch file with like May need to add double quotes if the file path or names includes spaces... There are just so many options using batch files... And a word of warning, while I have considerable confidence in And such a batch file system could even copy the original to a safe place first... Also note you can HTH... |
@geoffmcl , thanks for the answer. Batch file — is Windows-specific solution, not compatible for UNIX users. Is it cross-platform solution, for Windows and UNIX both? Thanks. |
This isn't really a Unix or DOS support site, but try |
@Kristinita yes, my answer suggested using batch files since the example you gave Had it been in unix, the normal unix shell will already expand a command like The important issue is that console As mentioned it does accept multiple files on its command line... HTH... |
20201123: @Kristinita seems question asked, and answered, so closing this... Please provide further feedback if there is still some outstanding question... thanks... |
For anyone else who is trying to do this, ChatGPT gave me this to work on Windows Command Prompt: @echo off
setlocal enabledelayedexpansion
set "tidy_command=tidy --tidy-mark 0 -m"
for %%f in (*.html) do (
echo Processing file: %%f
!tidy_command! "%%f"
)
endlocal I improved it by adding |
Type: Solution ⭐ 1. Cross-platform commands for Windows and UNIXUse fd for running Tidy recursively. For example, I want to modify and then check all The command for modifying files: fd . output --extension html --exec tidy -config tidy.conf -modify || true The command for validating files: fd . output --extension html --exec tidy -config tidy.conf --markup-no 2. Commands explanation
Thanks. |
1. Briefly
I don't find, how I can modify multiple files in multiple folders use HTML Tidy.
2. Structure
Example site structure:
In real project I have more than 100 HTML files.
3. Expected behavior
Modifying
SashaTest.html
andTidyTest.html
files.It works for me for single files:
4. Actual behavior
I can't use glob patterns, examples:
5. Did not help
I use Grunt for building my site. grunt-htmltidy support multiple files, but plugin works with bugs and, possibly, no longer maintained, see #6.
Thanks.
The text was updated successfully, but these errors were encountered: