alikothari / htmlcompressor

Automatically exported from code.google.com/p/htmlcompressor
Apache License 2.0
0 stars 0 forks source link

How to compress whole directories #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

I can not chose one or more directories to compress, only single files. If I 
enter the input directories without an output, it will always tell me that and 
output directory is needed (I though if none is specified, the input folder is 
used?)
IF I specifiy an output folder, nothing will happen.
Could you please tell me the code to compress everything in folder /in and 
either overwrite these files or save everything to /out? Thank you!

Original issue reported on code.google.com by vitam...@t-online.de on 16 Sep 2011 at 9:39

GoogleCodeExporter commented 9 years ago
You are probably not entering trailing slashes. It should be:

java -jar htmlcompressor.jar --type html -o /in/ /out/

Original comment by serg472@gmail.com on 16 Sep 2011 at 3:29

GoogleCodeExporter commented 9 years ago
Also you should always provide output directory, it doesn't use current one by 
default.

Original comment by serg472@gmail.com on 16 Sep 2011 at 3:30

GoogleCodeExporter commented 9 years ago

Original comment by serg472@gmail.com on 21 Sep 2011 at 2:09

GoogleCodeExporter commented 9 years ago
It's still not working. 
If I want /in to be my input folder and /out to be my output, shouldn't the 
code look like this instead: 
java -jar htmlcompressor.jar --type html -o /out/ /in/ ? 

But no matter how I try it, it won't do anything...

Original comment by vitam...@t-online.de on 21 Sep 2011 at 8:41

GoogleCodeExporter commented 9 years ago
Ok so I have found out that folders can not be included with their relative 
path (while single files can). I was trying to compress everything in 
c:\htmlcomp\in and output it to c:\htmlcomp\out.
Defining only /in/ and /out/ in the bat file, will however create both folders 
in c:\

So I am using the absolute path and at least the out folder is created 
correctly in the htmlcompressor directory - besides that however, nothing will 
happen..

Original comment by vitam...@t-online.de on 21 Sep 2011 at 12:25

GoogleCodeExporter commented 9 years ago
You are right, java -jar htmlcompressor.jar --type html -o /out/ /in/ is the 
right one.

"/in/" means "in" dir in the root folder, if you want relative path from the 
current folder (where jar file is) then it should be "in/". 

What's inside that folder? Are there any *.html/*.htm files? Because it only 
compresses those by default, and doesn't include sub-directories.

Original comment by serg472@gmail.com on 21 Sep 2011 at 3:22

GoogleCodeExporter commented 9 years ago
[quote] "/in/" means "in" dir in the root folder, if you want relative path 
from the current folder (where jar file is) then it should be "in/". [/quote]

Ok, this makes perfect sense now!

There are files and subdirectories present - however, .phtml files only. So 
this must be the root of the evil. Since it will compress single phtml files, I 
thought it would work for folders too.
Alos, --recursive should allow me to include subdirectories, right?

Original comment by vitam...@t-online.de on 21 Sep 2011 at 4:35

GoogleCodeExporter commented 9 years ago
Something like this should work then:

java -jar htmlcompressor.jar --type html --recursive --mask *.phtml -o out/ in/

Original comment by serg472@gmail.com on 21 Sep 2011 at 4:46

GoogleCodeExporter commented 9 years ago
Also you probably would want to preserve <?php> tags with --preserve-php 
parameter.

Original comment by serg472@gmail.com on 21 Sep 2011 at 4:48

GoogleCodeExporter commented 9 years ago
Thank you, this looks very promising!
I'll try this as soon as I am back at home.

Thank you so much for your effort and help. You have been more than kind!

Btw, I wanted to include --preserve-php parameter but found out, that even 
without it, they stay untouched..

Original comment by vitam...@t-online.de on 21 Sep 2011 at 4:56

GoogleCodeExporter commented 9 years ago

Original comment by serg472@gmail.com on 28 Sep 2011 at 3:21