pixijs / assetpack

A configurable asset pipeline for the web
http://pixijs.io/assetpack/
MIT License
105 stars 25 forks source link

Compress bypass option #73

Closed Fire7 closed 3 months ago

Fire7 commented 3 months ago

Add bypass options to the compress plugin. Bypassed assets are copied without any processing (this is the same behavior as in version <1.0 when the option was set to false).

Zyie commented 3 months ago

hey @Fire7 is the issue here that setting false does not work on the compress plugin?

this in theory should work see here: https://github.com/pixijs/assetpack/blob/ab3d570f9b48841a321cb021574d0dd71833b161/packages/assetpack/test/image/Compress.test.ts#L141-L144

Fire7 commented 3 months ago

Hello @Zyie!

Setting any format to false skips it (even if the source file is in that format). In our case, we want to bypass (copy without any compression) the source files (PNG and JPG) and also create modern format instances (WebP and AVIF).

Currently, if you set the options to {png: false, jpg: false, webp: {...}, avif: {...}}, only the WebP and AVIF instances are created, without the source JPG or PNG files. This is different from how it worked in versions before 1.0. 😞

However, I totally understand the need to avoid certain formats, so I think a custom option would be a good fit for more customizable behavior!

Zyie commented 3 months ago

@Fire7 thanks for putting this together and helping me understand the issue

I actually think this is a bug and the default behavior of the compress plugin should be to copy over the original image if png/jpg is set to false.

so I've created this PR #75 as an alternative to this one, however i will make sure to credit you in the release notes for this!