Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
mgol committed May 19, 2024
commit 63a67b9ce1cbe3ab9a8c0252c29fc5bcd6d3baf8
14 changes: 11 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

module.exports = function( grunt ) {

const { gzipSync } = require( "node:zlib" );

// files
const coreFiles = [
"widget.js",
Expand Down Expand Up @@ -74,7 +76,15 @@ const compareFiles = {
all: [
"dist/jquery-ui.js",
"dist/jquery-ui.min.js"
]
],
options: {
compress: {
gz: function( contents ) {
return gzipSync( contents ).length;
}
},
cache: "build/.sizecache.json"
}
};

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

uiFiles.forEach( function( file ) {

// TODO this doesn't do anything until https://github.com/rwldrn/grunt-compare-size/issues/13
compareFiles[ file ] = [ file, mapMinFile( file ) ];
} );

Expand Down