I'm using the rails asset pipeline for my rails site. The assets:precompile task properly processes and creates gzip versions of my css and js files automatically.
I've now added some xml assets. The asset pipeline lets me reference the files just as I do for binary files like images. However, the precompile task does not create gzip versions of the xml files even if I explicitly put them in "config.assets.precompile". My xml files are large assets and would get about 3 times faster with gzip, so this is an important optimization for my site. Is there any way to configure the pipeline to gzip files with additional extensions like ".xml"?
Notes:
I'm using the asset_sync gem to move all my static assets to the CloudFront CDN, so I can't rely on my webserver (NGINX) to automatically gzip the files for me. asset_sync will upload a gzipped version of a file if the asset-pipeline created one, but it won't create gzipped versions for you. I could theoretically fork asset_sync and hack it to gzip xml files before the upload or to insert an additional task between precompile and the sync tasks, but I would prefer to avoid maintaining a fork of the gem.
I've also thought tricking the asset pipeline by using a .js extension instead of .xml, but I'd prefer a less hacky solution.
If there's no clean way to just configure gzip on an additional file type, is there a way to add a custom "postprocessing" filter on files where I could add gzip manually? I've seen guides on how to add custom preprocessors but not a post processor on the final hashed asset file.