ritz078/rollup-plugin-filesize

File sizes before and after minification

Opened this issue · 7 comments

It would be great if filesize could show file sizes before and after minification (uglify, terser) and the percent points of compression as well.

makes sense.

Can we opt out of minification in this case? I'm currently using rollup-plugin-filesize@2 because I'm already doing minification myself and need just original and gzipped size.

@bisubus you can set showMinifiedSize to false.

Note that the new merges, do something somewhat different. The new merges (with showBeforeSizes enabled) peek at the dist file before it is overwritten (and kind of presumes that the current output.file was not minified since it shows before/after of the various minifications), showing how much the file size has changed since the last release (if one hasn't already overwritten it since the last release such as by running this multiple times).

I think this issue wanted to see how much the current size of source is being shaved down.

I got confused by this myself when I saw this issue.

I plan to prepare another PR now, @ritz078 , to document showBeforeSizes as I realize that had not been documented (as has render).

Did you want to reopen this then, @ritz078 ?

Was just thinking... If the new reporter option were changed to accept an array, and if the boxen implementation were relegated to being just another reporter (albeit a default one), people could choose what kind of console output they got as well as any additional badge creation, etc. (I can understand the appeal of boxen, as it is well-done, but to my taste, I'd like something more terse).

And all reporters (including the default) could be configured on what info to show--e.g., showing or not showing the sizes (or diffs) when the current config was set to be a minified build.

If it's ok, I'd like to submit a PR (as I may get a chance) which replaces render with an array of reporter--which will default to a single item array with the "boxen" reporter (to preserve past behavior except when the user had their own render method). Update: Submitted as #67.

I think this would also be more in line with the terminology used in nyc, mocha, etc.