Closed vHeemstra closed 1 year ago
If you need a file to test this functionality, I used a .woff2
web font file from Nunito on Google Fonts. This file can be found here.
The compressed version of this file (either GZip or Brotli) is 1 byte larger than the original, so it should be skipped if skipIfLargerOrEqual
is true
.
LGTM. I'll let the tests run before merging the code
I set skipIfLargerOrEqual
as false
. When we set true
as default it will break most of test case :(
@vHeemstra cc
I set
skipIfLargerOrEqual
asfalse
. When we settrue
as default it will break most of test case :(
That's fine too.
Maybe it breaks the test cases because their compressed output is larger than or equal to the original content?
Yes. previous test case don't support it. So i write a new test case.
The v0.10.0
has been released
This PR adds the option to skip outputting the compressed file if it is larger than or equal to the original file. This is on by default, but can be disabled using option
skipIfLargerOrEqual: false
.Reason for adding this: Compressing assets is to reduce site traffic (amount) which improves load time in turn. However, if the compressed file is larger than (or equal to) the original file, there is no benefit, so skipping seems more appropriate then.
(Oh, and I fixed a typo)