{"id":16990,"library":"ember-cli-deploy-gzip","title":"Ember CLI Deploy Gzip Plugin","description":"ember-cli-deploy-gzip is a plugin for the Ember CLI Deploy ecosystem, designed to perform in-place gzip compression of static assets as part of a deployment pipeline. Its primary function is to prepare files for upload to asset hosts that expect pre-compressed content, ensuring efficient delivery. The current stable version is 3.0.0, released recently with updated dependencies and Node.js version requirements, maintaining active development. While it does not follow a fixed release cadence, updates are typically driven by Ember CLI or Node.js compatibility needs, or bug fixes. A key differentiator is its seamless integration into the `ember-cli-deploy` workflow, allowing declarative configuration for which file types to compress, including an `ignorePattern` for specific exclusions. It also offers the option to use `node-zopfli` for stronger (though slower) compression. This plugin abstracts away the direct use of compression libraries, providing a higher-level, deployment-focused solution for Ember applications.","status":"active","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/ember-cli-deploy/ember-cli-deploy-gzip","tags":["javascript","ember-addon","ember-cli-deploy-plugin"],"install":[{"cmd":"npm install ember-cli-deploy-gzip","lang":"bash","label":"npm"},{"cmd":"yarn add ember-cli-deploy-gzip","lang":"bash","label":"yarn"},{"cmd":"pnpm add ember-cli-deploy-gzip","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides `distDir` and `distFiles` which are prerequisites for this plugin.","package":"ember-cli-deploy-build","optional":false},{"reason":"Required only if the `zopfli` configuration option is set to `true` for stronger compression.","package":"node-zopfli","optional":true}],"imports":[{"note":"This command integrates the addon into your Ember CLI project's build and deploy pipeline, making it available for configuration.","wrong":"npm install ember-cli-deploy-gzip","symbol":"ember install command","correct":"ember install ember-cli-deploy-gzip"},{"note":"Ember CLI Deploy plugins are configured by their short name ('gzip' in this case) within the `plugins` array of your `config/deploy.js`, not via standard JavaScript module imports.","wrong":"import { gzip } from 'ember-cli-deploy-gzip';","symbol":"Gzip plugin inclusion","correct":"module.exports = function(deployTarget) { return { plugins: ['gzip'], ... }; };"},{"note":"Specific options for the `gzip` plugin are defined as a top-level property (`gzip`) within the deployment configuration object in `config/deploy.js`.","wrong":"app.import('node_modules/ember-cli-deploy-gzip/index.js');","symbol":"Gzip plugin configuration","correct":"module.exports = function(deployTarget) { return { gzip: { filePattern: '**/*.{js,css}' }, ... }; };"}],"quickstart":{"code":"// config/deploy.js\nmodule.exports = function(deployTarget) {\n  var ENV = {\n    build: {\n      environment: 'production'\n    },\n    gzip: {\n      filePattern: '**/*.{js,css,json,ico,map,xml,txt,svg,eot,ttf}', // Default pattern\n      // keep: true, // Example: keep original files and create .gz versions\n      // zopfli: true // Example: use zopfli for stronger compression (requires `node-zopfli` install)\n    }\n  };\n\n  if (deployTarget === 'production') {\n    // Example: configure S3 deployment alongside gzip\n    ENV.s3 = {\n      accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? '',\n      secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? '',\n      bucket: 'your-production-asset-bucket',\n      region: 'us-east-1'\n    };\n  }\n\n  // Include the necessary plugins in the deployment pipeline\n  ENV.plugins = ['build', 'gzip', 's3']; // 'build' and 's3' are common companions\n\n  return ENV;\n};\n\n// Terminal commands\n// 1. Ensure prerequisite Ember CLI Deploy plugins are installed (e.g., build, an asset host like s3)\n// $ ember install ember-cli-deploy-build\n// $ ember install ember-cli-deploy-s3\n// 2. Install this gzip plugin\n// $ ember install ember-cli-deploy-gzip\n// 3. Run the deployment\n// $ AWS_ACCESS_KEY_ID=\"YOUR_KEY\" AWS_SECRET_ACCESS_KEY=\"YOUR_SECRET\" ember deploy production\n","lang":"javascript","description":"This quickstart demonstrates how to install `ember-cli-deploy-gzip` and configure it within `config/deploy.js` for an Ember CLI Deploy pipeline, typically alongside `ember-cli-deploy-build` and an asset-upload plugin like `ember-cli-deploy-s3`."},"warnings":[{"fix":"Ensure your project's Node.js environment is at version `14.x || 16.x || 18.x || >= 20.x`. Update `npm` or `yarn` dependencies if encountering package resolution issues.","message":"Version 3.0.0 introduced breaking changes, primarily by updating internal dependencies and raising the minimum supported Node.js versions. Users on older Node.js runtimes (prior to 14.x) must upgrade.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"If `zopfli: true` is configured, run `npm install node-zopfli --save-dev` or `yarn add node-zopfli --dev` in your project.","message":"If the `zopfli` configuration option is set to `true` for stronger compression, the `node-zopfli` package must be manually installed as a development dependency. It is not bundled with `ember-cli-deploy-gzip`.","severity":"gotcha","affected_versions":">=0.2.2"},{"fix":"Ensure your `filePattern` and `ignorePattern` configurations in `config/deploy.js` exclude already compressed asset types. The default `filePattern` intelligently avoids common image formats.","message":"Certain file types, particularly image formats like `.png`, `.jpg`, and `.gif`, are already highly compressed and should generally not be gzipped again. Doing so can sometimes increase file size or offer negligible gains.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure `ember-cli-deploy-build` is installed (`ember install ember-cli-deploy-build`) and correctly configured in your deployment pipeline before `ember-cli-deploy-gzip`.","message":"This plugin relies on the `distDir` and `distFiles` properties being present on the deployment `context` object. These are typically provided by the `ember-cli-deploy-build` plugin, which is a common prerequisite.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Install the `node-zopfli` package as a development dependency: `npm install node-zopfli --save-dev` or `yarn add node-zopfli --dev`.","cause":"The `zopfli` option was enabled in `config/deploy.js` (e.g., `gzip: { zopfli: true }`) but the `node-zopfli` package was not installed.","error":"Cannot find module 'node-zopfli'"},{"fix":"Review the `filePattern` and `ignorePattern` settings in your `config/deploy.js`. Verify that `'gzip'` is present in the `plugins` array. Also, check if `keep: false` is set and you are looking for `.gz` files instead of the originals.","cause":"Incorrect `filePattern` or `ignorePattern` configuration, or `ember-cli-deploy-gzip` is not properly included in the `plugins` array in `config/deploy.js`.","error":"The Ember CLI Deploy pipeline executed, but files are not being gzipped as expected."},{"fix":"Upgrade your Node.js environment to a compatible version (e.g., `14.x || 16.x || 18.x || >= 20.x`) or downgrade `ember-cli-deploy-gzip` to a compatible version if your project cannot upgrade Node.js.","cause":"Your current Node.js version is incompatible with the installed version of `ember-cli-deploy-gzip`, particularly after the v3.0.0 breaking change.","error":"Error: Node.js vX.X.X is not supported by ember-cli-deploy-gzip."}],"ecosystem":"npm","meta_description":null}