Ember CLI Deploy Gzip Plugin

3.0.0 · active · verified Wed Apr 22

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.

Common errors

Warnings

Install

Imports

Quickstart

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`.

// config/deploy.js
module.exports = function(deployTarget) {
  var ENV = {
    build: {
      environment: 'production'
    },
    gzip: {
      filePattern: '**/*.{js,css,json,ico,map,xml,txt,svg,eot,ttf}', // Default pattern
      // keep: true, // Example: keep original files and create .gz versions
      // zopfli: true // Example: use zopfli for stronger compression (requires `node-zopfli` install)
    }
  };

  if (deployTarget === 'production') {
    // Example: configure S3 deployment alongside gzip
    ENV.s3 = {
      accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? '',
      secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? '',
      bucket: 'your-production-asset-bucket',
      region: 'us-east-1'
    };
  }

  // Include the necessary plugins in the deployment pipeline
  ENV.plugins = ['build', 'gzip', 's3']; // 'build' and 's3' are common companions

  return ENV;
};

// Terminal commands
// 1. Ensure prerequisite Ember CLI Deploy plugins are installed (e.g., build, an asset host like s3)
// $ ember install ember-cli-deploy-build
// $ ember install ember-cli-deploy-s3
// 2. Install this gzip plugin
// $ ember install ember-cli-deploy-gzip
// 3. Run the deployment
// $ AWS_ACCESS_KEY_ID="YOUR_KEY" AWS_SECRET_ACCESS_KEY="YOUR_SECRET" ember deploy production

view raw JSON →