Skip to content

Commit 8eb1e7b

Browse files
authored
Update README (#19)
Add gzip comparison metrics
1 parent d91f58c commit 8eb1e7b

File tree

3 files changed

+87
-30
lines changed

3 files changed

+87
-30
lines changed

README.md

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,39 +21,67 @@ SensioLabs Minify Bundle integrates [Minify](https://github.com/tdewolff/minify)
2121

2222
### Asset Minifier
2323

24-
✅ Minify `CSS` and `JS` files, remove whitespace, comments, and more..
24+
✅ Minify `CSS` and `JS` files, remove whitespace, comments, and more..
2525

26-
🌍🌍 Reduces the size of your assets by up to `70%` (see metrics below).
26+
🌍 Reduces the size of your assets by up to `70%` (see metrics below).
2727

28-
🚀🚀🚀 Improves the loading time of your website, and the `user experience`.
28+
🚀 Improves the loading time of your website, and the `user experience`.
2929

3030
### Asset Mapper
3131

3232
🎯 Automatically `minify` assets during the build process.
3333

34-
📦📦 Stores minified assets in the Symfony `cache`.
34+
📦 Stores minified assets in the Symfony `cache`.
3535

36-
🌿🌿🌿 Download the Minify binary `automatically` from Github.
36+
🌿 Download the Minify binary `automatically` from Github.
3737

3838
## Minification
3939

4040
### JavaScript
4141

42-
| Asset | Before | After | Diff | Compression | Time |
43-
|------------------------|-------:|-------:|-----:|------------------------------------------|------:|
44-
| [Autocomplete.js][1] | 20 kB | 9.2 kB | -54% | ⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 | 8 ms |
45-
| [Bootstrap.js][3] | 145 kB | 62 kB | -57% | ⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 | 10 ms |
46-
| [Video.js][5] | 2.3 MB | 0.7 MB | -71% | ⬜️⬜️⬜️⬜️⬜️⬜️🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 | 42 ms |
47-
| [w3c.org js][7] | 44 kB | 19 kB | -57% | ⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 | 6 ms |
42+
| File | Original | Minified | Ratio | Gain | Compression | Time |
43+
|----------------------|----------:|----------:|-------:|-------:|---------------------:|------:|
44+
| [autocomplete.js][1] | 19.88 KB | 9.17 KB | 46.13% | 53.87% | 🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️ | 8 ms |
45+
| [bootstrap.js][3] | 145.40 KB | 62.20 KB | 42.76% | 57.24% | 🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️ | 10 ms |
46+
| [video.js][5] | 2.35 MB | 690.10 KB | 29.33% | 70.67% | 🟩🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️ | 42 ms |
47+
| [w3c.org js][7] | 43.39 KB | 19.23 KB | 44.34% | 55.66% | 🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️ | 6 ms |
48+
49+
Even gzip compression is more efficient on minified assets (see metrics below).
50+
51+
<details>
52+
53+
<summary> See transfert comparaison (gzip) </summary>
54+
55+
| File | Original | Minified | Ratio | Gain | Compression |
56+
|-----------------|-----------:|----------:|-------:|-------:|---------------------:|
57+
| autoComplete.js | 5.59 KB | 2.68 KB | 47.96% | 52.04% | 🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️ |
58+
| bootstrap.js | 29.92 KB | 12.58 KB | 42.06% | 57.94% | 🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️ |
59+
| video.js | 538.83 KB | 202.62 KB | 37.61% | 62.39% | 🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️ |
60+
| w3c.org.js | 10.44 KB | 5.89 KB | 56.45% | 43.55% | 🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️ |
61+
62+
</details>
4863

4964
### CSS
5065

51-
| Asset | Before | After | Diff | Compression | Time |
52-
|-----------------------|-------:|-------:|-----:|-------------------------------------------|-----:|
53-
| [Autocomplete.css][2] | 3.1 kB | 2.5 kB | -19% | ⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️🟩🟩🟩🟩🟩 | 2 ms |
54-
| [Bootstrap.css][4] | 281 kB | 232 kB | -18% | ⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️🟩🟩🟩🟩 | 9 ms |
55-
| [Video-js.css][6] | 53 kB | 47 kB | -12% | ⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜⬜️⬜️⬜️⬜️⬜️⬜️⬜️️🟩🟩 | 4 ms |
56-
| [w3c.org css][8] | 111 kB | 70 kB | -37% | ⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️🟩🟩🟩🟩🟩🟩🟩🟩 | 5 ms |
66+
| File | Original | Minified | Ratio | Gain | Compression | Time |
67+
|-----------------------|----------:|----------:|-------:|-------:|---------------------:|-----:|
68+
| [autocomplete.css][2] | 3.09 KB | 2.51 KB | 81.33% | 18.67% | 🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️ | 2 ms |
69+
| [bootstrap.css][4] | 281.05 KB | 231.89 KB | 82.51% | 17.49% | 🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️ | 9 ms |
70+
| [video-js.css][6] | 53.37 KB | 47.06 KB | 88.24% | 11.76% | 🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️ | 4 ms |
71+
| [w3c.org css][8] | 111.44 KB | 70.37 KB | 63.17% | 36.83% | 🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️ | 5 ms |
72+
73+
<details>
74+
75+
<summary> See transfert comparaison (gzip) </summary>
76+
77+
| File | Original | Minified | Ratio | Gain | Compression |
78+
|------------------|-----------:|----------:|-------:|-------:|---------------------:|
79+
| autoComplete.css | 1.08 KB | 0.89 KB | 82.41% | 17.59% | 🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️ |
80+
| bootstrap.css | 33.56 KB | 28.94 KB | 86.08% | 13.92% | 🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️ |
81+
| video-js.css | 13.14 KB | 12.72 KB | 96.79% | 3.21% | 🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️ |
82+
| w3c.org.css | 21.98 KB | 13.65 KB | 62.13% | 37.87% | 🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️ |
83+
84+
</details>
5785

5886
## Installation
5987

@@ -71,6 +99,10 @@ composer require sensiolabs/minify-bundle
7199

72100
### Without Symfony Flex
73101

102+
<details>
103+
104+
<summary> How to install without Symfony Flex</summary>
105+
74106
#### Step 1: Download the Bundle
75107

76108
Open a command console, enter your project directory and execute the
@@ -97,6 +129,8 @@ return [
97129
Depending on your deployment process, you might want to enable the
98130
bundle only in the desired environment(s).
99131

132+
</details>
133+
100134
## Usage
101135

102136
If you use [AssetMapper][9], run the following command to minify all the assets:
@@ -130,7 +164,7 @@ php bin/console minify:asset css/main.css css/main.min.css
130164

131165
## Configuration
132166

133-
### AssetMapper Settings
167+
### AssetMapper
134168

135169
```yaml
136170
# config/packages/sensiolabs_minify.yaml
@@ -154,6 +188,8 @@ sensiolabs_minify:
154188
155189
### Minify Binary
156190
191+
#### Local binary
192+
157193
The minification is performed by a binary file that can be installed on your
158194
computer/server or downloaded automatically by the bundle. This is the default
159195
configuration used by the bundle:

doc/bench.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Benchmarks
22

3-
## Download files
3+
## Setup
4+
5+
### Download files
46

57
```
68
curl -O https://cdn.jsdelivr.net/npm/@tarekraafat/[email protected]/dist/autoComplete.js
@@ -13,9 +15,36 @@ curl -O https://cdn.jsdelivr.net/npm/[email protected]/dist/video-js.css
1315
curl -O https://raw.githubusercontent.com/w3c/w3c-website-templates-bundle/refs/heads/main/public/dist/assets/styles/core.css
1416
```
1517

16-
17-
## Minify files
18+
### Minify files
1819

1920
```
20-
minify -s -o min/ *
21+
minify -s -o minify/ *
2122
```
23+
24+
## Results
25+
26+
### Size comparison
27+
28+
| File | Original | Minified | Ratio | Gain | Compression |
29+
|------------------|----------:|----------:|-------:|-------:|---------------------:|
30+
| autoComplete.css | 3.09 KB | 2.51 KB | 81.33% | 18.67% | 🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️ |
31+
| autoComplete.js | 19.88 KB | 9.17 KB | 46.13% | 53.87% | 🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️ |
32+
| bootstrap.css | 281.05 KB | 231.89 KB | 82.51% | 17.49% | 🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️ |
33+
| bootstrap.js | 145.40 KB | 62.20 KB | 42.76% | 57.24% | 🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️ |
34+
| core.css | 111.44 KB | 70.37 KB | 63.17% | 36.83% | 🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️ |
35+
| main.js | 43.39 KB | 19.23 KB | 44.34% | 55.66% | 🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️ |
36+
| video-js.css | 53.37 KB | 47.06 KB | 88.24% | 11.76% | 🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️ |
37+
| video.js | 2.35 MB | 690.10 KB | 29.33% | 70.67% | 🟩🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️ |
38+
39+
### Transfert comparison (gzip)
40+
41+
| File | Original | Minified | Ratio | Gain | Compression |
42+
|------------------|-----------:|----------:|-------:|-------:|---------------------:|
43+
| autoComplete.css | 1.08 KB | 0.89 KB | 82.41% | 17.59% | 🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️ |
44+
| autoComplete.js | 5.59 KB | 2.68 KB | 47.96% | 52.04% | 🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️ |
45+
| bootstrap.css | 33.56 KB | 28.94 KB | 86.08% | 13.92% | 🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️ |
46+
| bootstrap.js | 29.92 KB | 12.58 KB | 42.06% | 57.94% | 🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️ |
47+
| core.css | 21.98 KB | 13.65 KB | 62.13% | 37.87% | 🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️ |
48+
| main.js | 10.44 KB | 5.89 KB | 56.45% | 43.55% | 🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️ |
49+
| video-js.css | 13.14 KB | 12.72 KB | 96.79% | 3.21% | 🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️ |
50+
| video.js | 538.83 KB | 202.62 KB | 37.61% | 62.39% | 🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️ |

doc/index.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)