PluginProbe ʕ •ᴥ•ʔ
10Web Booster – Website speed optimization, Cache & Page Speed optimizer / trunk
10Web Booster – Website speed optimization, Cache & Page Speed optimizer vtrunk
2.33.6 2.33.5 2.33.0 2.30.5 2.30.7 2.30.9 2.31.10 2.31.8 2.32.11 2.32.21 2.32.3 2.32.4 2.32.7 2.6.31 2.6.40 2.6.42 2.6.7 2.7.37 2.7.44 2.7.47 2.8.18 2.8.19 2.8.32 2.8.34 2.8.35 2.9.23 2.9.24 2.9.25 2.9.27 v2.27.4 trunk 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.17 2.0.18 2.0.21 2.0.22 2.0.25 2.0.26 2.0.27 2.0.3 2.0.7 2.0.9 2.10.46 2.10.65 2.10.66 2.10.68 2.11.41 2.11.42 2.11.43 2.12.15 2.12.21 2.12.22 2.12.23 2.12.26 2.13.37 2.13.40 2.13.41 2.13.42 2.13.44 2.13.45 2.13.47 2.14.49 2.14.50 2.15.18 2.17.21 2.17.23 2.18.17 2.19.44 2.19.45 2.19.46 2.19.49 2.2.12 2.2.15 2.2.16 2.2.18 2.2.8 2.20.31 2.20.32 2.20.33 2.21.11 2.21.12 2.21.16 2.21.25 2.22.32 2.23.13 2.23.15 2.23.16 2.23.18 2.24.12 2.24.14 2.24.18 2.25.14 2.26.6 2.28.10 2.28.13 2.28.14 2.28.7 2.29.1 2.29.2 2.29.3 2.3.0 2.3.1 2.3.2 2.3.3 2.30.18
tenweb-speed-optimizer / vendor / pfaciana / tiny-html-minifier / readme.md
tenweb-speed-optimizer / vendor / pfaciana / tiny-html-minifier Last commit date
src 3 years ago tests 3 years ago changelog.md 3 years ago composer.json 3 years ago license 3 years ago readme.md 3 years ago
readme.md
150 lines
1 # Tiny Html Minifier
2
3 ![Version 2.2](https://img.shields.io/badge/version-2.2-blue.svg) ![MIT license](https://img.shields.io/badge/license-MIT-green.svg) [](https://www.paypal.me/DevoneraAB![Donate](https://img.shields.io/badge/give-donation-yellow.svg)](https://www.paypal.me/DevoneraAB](https://www.paypal.me/DevoneraAB)
4
5 [](changelog.mdChangelog](changelog.md](changelog.md)
6
7 ## In short
8
9 - A HTML minifier in PHP.
10 - It's really really fast.
11 - Only 1 file is required.
12 - Almost no regular expressions.
13 - Almost no options.
14
15 ## Details - What the minifier does
16
17 - Remove HTML comments.
18 - Remove slash in self closing elements. ` />` becomes `>`.
19 - Remove ` type="text/css"` and `type="text/javascript"` in `style` and `script` tags.
20 - Minimize elements within `<head></head>`. It will not keep any whitespace (except inside `script`).
21 - Minimize elements within `<body></body>` but keep spaces between tags to preserve inline data (optional).
22 - Minimize inline SVG files (which are a bunch of XML tags).
23 - Minimize Custom Elements. They look like this: `<my-element>My content</my-element>`.
24 - Skip `code`, `pre`, `script` and `textarea` from being minified.
25
26 ## Install & usage
27
28 ### 1. Download
29
30 **ZIP**
31
32 Download `tiny-html-minifier.php` or the whole ZIP.
33
34 **Composer**
35
36 You can install it with Composer as well.
37
38 ### 2. Add the code
39
40 ```php
41 <?php
42 require 'tiny-html-minifier.php';
43 echo TinyMinify::html($html);
44 ```
45
46 ## Before / after
47
48 ### Before
49
50 ```html
51 <!doctype html>
52 <html lang="en">
53 <head>
54
55 <meta charset="utf-8" />
56 <meta name="viewport" content="width=device-width,initial-scale=1.0" />
57
58 <link href="http://example.com/style.css" rel="stylesheet" />
59 <link rel="icon" href="http://example.com/favicon.png" />
60
61 <title>Tiny Html Minifier</title>
62
63 </head>
64 <body class="body">
65
66 <div class="main-wrap">
67 <main>
68 <textarea>
69 Some text
70 with newlines
71 and some spaces
72 </textarea>
73
74 <div class="test">
75 <p>This text</p>
76 <p>should not</p>
77 <p>wrap on multiple lines</p>
78 </div>
79 </main>
80 </div>
81 <script>
82 console.log('Script tags are not minified');
83 console.log('This is inside a script tag');
84 </script></body>
85 </html>
86 ```
87
88 ### After
89
90 ```html
91 <!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><link href="http://example.com/style.css" rel="stylesheet"><link rel="icon" href="http://example.com/favicon.png"><title>Tiny Html Minifier</title></head> <body class="body"><div class="main-wrap"> <main> <textarea>
92 Some text
93 with newlines
94 and some spaces
95 </textarea> <div class="test"> <p>This text</p> <p>should not</p> <p>wrap on multiple lines</p> </div> </main> </div> <script>
96 console.log('Script tags are not minified');
97 console.log('This is inside a script tag');
98 </script></body></html>
99 ```
100
101 ## Options
102
103 ```php
104 <?php
105 require 'tiny-html-minifier.php';
106 echo TinyMinify::html($html, $options = [
107 'collapse_whitespace' => false,
108 'disable_comments' => false,
109 ]);
110 ```
111
112 ### collapse_whitespace
113
114 #### Not collapsed
115
116 Spaces are preserved (except for most elements within `<head></head>`). It's good when using the elements inline. This is the default.
117
118 ```html
119 <ul><li> <a href="#"> My link </a></li><li> <a href="#"> My link </a></li> </ul>
120 ```
121
122 #### Collapsed
123
124 Spaces are collapsed. The text inside the element is still untouched. Set this value to `true` and you will save a few extra bytes.
125
126 ```html
127 <ul><li><a href="#">My link</a></li><li><a href="#">My link</a></li></ul>
128 ```
129
130 ## Requirements
131
132 - PHP7+
133
134 ## Disclaimer
135
136 This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please [](https://github.com/jenstornell/tiny-html-minifier/issues/newcreate a new issue](https://github.com/jenstornell/tiny-html-minifier/issues/new](https://github.com/jenstornell/tiny-html-minifier/issues/new).
137
138 ## License
139
140 [](https://github.com/jenstornell/tiny-html-minifier/blob/master/licenseMIT](https://github.com/jenstornell/tiny-html-minifier/blob/master/license](https://github.com/jenstornell/tiny-html-minifier/blob/master/license)
141
142 It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.
143
144 ## Donate
145
146 If you want to make a donation, you can do that by sending any amount https://www.paypal.me/DevoneraAB
147
148 ## Credits
149
150 - [](https://github.com/jenstornellJens Törnell](https://github.com/jenstornell](https://github.com/jenstornell)