Skip to content

Commit f017426

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-2248 Ref gh-2254
1 parent 795b773 commit f017426

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
@@ -75,7 +75,17 @@ const compareFiles = {
7575
all: [
7676
"dist/jquery-ui.js",
7777
"dist/jquery-ui.min.js"
78-
]
78+
],
79+
options: {
80+
compress: {
81+
gz: function( contents ) {
82+
const { gzipSync } = require( "node:zlib" );
83+
84+
return gzipSync( contents ).length;
85+
}
86+
},
87+
cache: "build/.sizecache.json"
88+
}
7989
};
8090

8191
const htmllintBad = [
@@ -115,8 +125,6 @@ uiFiles.concat( allI18nFiles ).forEach( function( file ) {
115125
} );
116126

117127
uiFiles.forEach( function( file ) {
118-
119-
// TODO this doesn't do anything until https://github.com/rwldrn/grunt-compare-size/issues/13
120128
compareFiles[ file ] = [ file, mapMinFile( file ) ];
121129
} );
122130

0 commit comments

Comments
 (0)