How do you compress your Ember.js assets at build time?

Is there an accepted way for compressing Ember.js assets at build time?

I’m particularly interested in Zopfli solutions to minimize file sizes.

What type of assets are you trying to compress and how? Might help anyone trying to answer propose a better solution for you.

I use Ember CLI, and it automatically concatenates and minifies my JS and CSS files for me when doing a production build, so that is what I use. There are also add-on hooks that one can attach to for a more complex and custom build process – like gzip’ing assets – as well.

Gzipping HTML, CSS, and JavaScript assets are the main ones. Preferably with zopfli rather than gzip.

As long as you have some HTTP/application server that can serve pre-compressed assets (i.e. ones with .gz extensions appended), then take a look at ember-cli-gzip. And for modern browsers you can use ember-cli-brotli.

I recently looked for a way to use zopfli with ember-cli-gzip. When I couldn’t find a way I wrote ember-cli-zopfli as a drop-in replacement.

There’s also ember-cli-deploy-gzip and ember-cli-deploy-brotli if you use ember-cli-deploy.

1 Like

There is also GitHub - DockYard/ember-cli-deploy-compress: Compress your assets automatically choosing the best compression available for your browser targets which chooses gzip or brotli based on your config/targets.js file.