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
Add recursive option to command line #323
Comments
Good idea. I'd love to have this so please feel free to send a PR. |
This would be awesome. At the moment I'm trying to If html-minifier picks up STDOUT from some other process (such as Anyway: 'globs' would be awesome: |
I'm writing an npm script and I tried doing something like:
But it's not producing anything. Would be great indeed to have a output-folder flag. |
+1 for that feature! html-minifier seems to be the best HTML compressor out there! |
Damn right, it is! :) Sent from my iPhone
|
I know almost nothing about Node.js, but I know a little about Shell Script, so I made this script to minify HTML files from a folder and its subfolders: #!/bin/bash
# minify_html.sh
if test $# -ne 2
then
echo "usage: sh minify_html.sh sourcedir destdir";
exit 1;
fi
set -xv
for FOLDER in `find $1 -type d`
do
mkdir -p "$2/${FOLDER#$1}";
done
for HTML_FILE in `find $1 -type f -name "*.html"`
do
html-minifier --remove-comments -o "$2/${HTML_FILE#$1}" "$HTML_FILE";
done
for ASSET in `find $1 -type f ! -name "*.html"`
do
cp "$ASSET" "$2/${ASSET#$1}";
done How to use it:
What it does in those three
But it does not seem to work... =/ I'm trying to minify my personal website, and it seems like the html-minifier command crashes for the second file found in the second Am I doing something wrong? Did I forget something? |
|
Created a pull request to fix this, was generating a pain for me, hope this helps others as well, the idea is to use a --file-ext html, so you only parse what you want. Best Regards, |
"(libuv) kqueue(): Too many open files" |
I solved it by doing this. It will run for every html file in the directory you run it in find . -name *.html -type f -exec html-minifier -o {} {} --collapse-whitespace --remove-comments --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-tag-whitespace --use-short-doctype --minify-css true --minify-js true --file-ext html \; |
Hello,
Is there any plan to add recursive option to command line options + output dir option?
(in order to process multiple files inside subdirectories)
This command would process all *.html files inside src directory and output would be written in dest directory.
The text was updated successfully, but these errors were encountered: