Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gzip size on a non minified output #36

Open
samouss opened this issue Jan 9, 2019 · 0 comments
Open

Use gzip size on a non minified output #36

samouss opened this issue Jan 9, 2019 · 0 comments

Comments

@samouss
Copy link

samouss commented Jan 9, 2019

From the version 5.0.0 the gzip size is always computed on a minified bundle. But it might happen that you want to display the size for a non minified bundle (e.g Rollup is used to generate two bundles one minified and one non minified).

filesize({
  showMinifiedSize: false,
  showGzippedSize: true,
}),

// expected output → file size gzipped on non minified source code

filesize({
  showMinifiedSize: true,
  showGzippedSize: true,
}),

// expected output → file size gzipped on minified source code

if (opts.showMinifiedSize || opts.showGzippedSize) {
const minifiedCode = terser.minify(code).code;
sizes.minSize = opts.showMinifiedSize
? fileSize(minifiedCode.length, opts.format)
: "";
sizes.gzipSize = opts.showGzippedSize
? fileSize(gzip.sync(minifiedCode), opts.format)
: "";
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants