Currently, Phoenix's Digester does both digesting and compression. This doesn't work very well within a webpack environment. We use webpack to construct bundles, support dynamic module, and append content hashes to files for production.
Crucially, webpack exports a `manifest.json` file for us to be able to use! I'd like to split up Phoenix's Digester into two separate pieces so that we can support this use-case.
In the non-webpack case, it would look something like this:
- Digester runs, digests files, and generates cache_static_manifest.json
- Separate Compressor runs, compressing digested files to gzip and/or brotli
- At runtime, Endpoint loads the cache_static_manifest.json to translate static assets (and Plug.Static handles serving compressed versions of those files)
In the webpack case, we could then do something like:
- WebpackDigester runs, reads webpack's manifest.json, and generates cache_static_manifest.json. It won't need to digest the files because webpack's already done the digesting.
- Separate Compressor runs, compressing digested files to gzip and/or brotli
- At runtime, Endpoint loads the cache_static_manifest.json to translate static assets (and Plug.Static handles serving compressed versions of those files)
By separating the Digester and Compressor steps, we can make the Digester step a behaviour, and users can swap implementations in their config files based on whatever environment they're in.
What do y'all think?