README.md 1.37 KB
Newer Older
Daniel J. R. May's avatar
Daniel J. R. May committed
1
<!-- markdownlint-disable MD033 -->
Daniel J. R. May's avatar
Daniel J. R. May committed
2
# <img src="doc/images/logo.png" width="100" alt="Logo"/> XHTML Minimizer
Daniel J. R. May's avatar
Daniel J. R. May committed
3

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Minimise the size of XHTML files by:
* Removing comments.
* Removing the XML declaration.
* Replacing character and entity references with their equivilent UTF-8 character.
* Merging neibouring comments and cdata sections.
* Deleteing "meaningless" whitespace.

## Examples ##

Read `input.xhtml` and create a minimized version of it in `output.xhtml`.


```sh
xhtml-minimizer --output output.xhtml input.xhtml
```

Here we scan `input` directory looking for files of the form
`*.xhtml` which are minimized and saved in the `output` directory. We
can get a table of statistics about file size reductions by using the
`--verbose` flag.


```sh
xhtml-minimizer --verbose --output output input
             Input             |            Output             |      Reduction
-------------------------------------------------------------------------------------
Daniel J. R. May's avatar
Daniel J. R. May committed
30
        File        |   Size   |        File        |   Size   |    %      |   Size  
31
-------------------------------------------------------------------------------------
Daniel J. R. May's avatar
Daniel J. R. May committed
32
33
34
    index.xhtml     |  32131   |    index.xhtml     |  25555   |   20.5    |   6576  
      a.xhtml       |   3025   |      a.xhtml       |   2589   |   14.4    |   436   
      b.xhtml       |   8365   |      b.xhtml       |   7205   |   13.9    |   1160  
35
36

```