Skip to content

Commit 9180a81

Browse files
authored
Build: Report compressed sizes in compare_size
Just like it has always worked in Core. This will help with size comparisons between 1.13 & 1.14. After this PR: ``` $ grunt sizer Running "requirejs:js" (requirejs) task Running "uglify:main" (uglify) task >> 1 file created 549 kB → 267 kB Running "compare_size:all" (compare_size) task raw gz Sizes 549319 128757 dist/jquery-ui.js 266710 69612 dist/jquery-ui.min.js Done. ``` Before, only the less interesting `raw` sizes were reported. Closes gh-2254 Ref gh-2248
1 parent f47c7fe commit 9180a81

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Gruntfile.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
module.exports = function( grunt ) {
44

5+
const { gzipSync } = require( "node:zlib" );
6+
57
// files
68
const coreFiles = [
79
"widget.js",
@@ -74,7 +76,15 @@ const compareFiles = {
7476
all: [
7577
"dist/jquery-ui.js",
7678
"dist/jquery-ui.min.js"
77-
]
79+
],
80+
options: {
81+
compress: {
82+
gz: function( contents ) {
83+
return gzipSync( contents ).length;
84+
}
85+
},
86+
cache: "build/.sizecache.json"
87+
}
7888
};
7989

8090
const htmllintBad = [
@@ -105,8 +115,6 @@ uiFiles.concat( allI18nFiles ).forEach( function( file ) {
105115
} );
106116

107117
uiFiles.forEach( function( file ) {
108-
109-
// TODO this doesn't do anything until https://github.com/rwldrn/grunt-compare-size/issues/13
110118
compareFiles[ file ] = [ file, mapMinFile( file ) ];
111119
} );
112120

0 commit comments

Comments
 (0)