Giter Site home page Giter Site logo

ember-cli-deploy-gzip's Introduction

ember-cli-deploy-gzip

An ember-cli-deploy plugin to compress files in-place using gzip compression

This plugin compresses files in-place using gzip compression. This is helpful to prepare for upload to an asset host that expects files to be pre-compressed.

What is an ember-cli-deploy plugin?

A plugin is an addon that can be executed as a part of the ember-cli-deploy pipeline. A plugin will implement one or more of the ember-cli-deploy's pipeline hooks.

For more information on what plugins are and how they work, please refer to the Plugin Documentation.

Quick Start

To get up and running quickly, do the following:

$ ember install ember-cli-deploy-gzip
  • Run the pipeline
$ ember deploy

Installation

Run the following command in your terminal:

ember install ember-cli-deploy-gzip

ember-cli-deploy Hooks Implemented

For detailed information on what plugin hooks are and how they work, please refer to the Plugin Documentation.

  • configure
  • willUpload

Configuration Options

For detailed information on how configuration of plugins works, please refer to the Plugin Documentation.

filePattern

Files matching this pattern will be gzipped. Note: image files such as .png, .jpg and .gif should not be gzipped, as they already are compressed.

Default: '\*\*/\*.{js,css,json,ico,map,xml,txt,svg,eot,ttf}'

ignorePattern

Files matching this pattern will not be gzipped even if they match filePattern

Default: null

distDir

The root directory where the files matching filePattern will be searched for. By default, this option will use the distDir property of the deployment context, provided by ember-cli-deploy-build.

Default: context.distDir

distFiles

The list of built project files. This option should be relative to distDir and should include the files that match filePattern. By default, this option will use the distFiles property of the deployment context, provided by ember-cli-deploy-build.

Default: context.distDir

zopfli

Use node-zopfli for compression (better than regular gzip compression, but slower).

If set to true, you will need to npm install node-zopfli --save-dev in your app.

Default: false

keep

Keep original file and write compressed data to originalFile.gz

Default: false

Prequisites

The following properties are expected to be present on the deployment context object:

Plugins known to work well with this one

ember-cli-deploy-build ember-cli-deploy-s3

Running Tests

  • yarn test

Why ember build and ember test don't work

Since this is a node-only ember-cli addon, this package does not include many files and dependencies which are part of ember-cli's typical ember build and ember test processes.

ember-cli-deploy-gzip's People

Contributors

achambers avatar avdv avatar chrisgame avatar dannyfallon avatar dependabot[bot] avatar dschmidt avatar ghedamat avatar jasonkriss avatar jrjohnson avatar lukemelia avatar wagenet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ember-cli-deploy-gzip's Issues

Why compress jpg, png and gif?

I just saw that jpg, png and gif images are compressed by default. These formats already are compressed and it is unlikely that gzipping them will reduce the file size. In fact, it might even increase it and / or introduce a slight performance regression on the client-side due to the added (and unnecessary) CPU work.

If this is a mistake and not intended, I'll submit a PR to fix this - if wanted.

ignorePattern doesn't seem to be working

Howdy 👋

Just trying to stop this gzipping my sourcemaps and I've been trying to add an ignorePattern that doesn't seem to be working 😕

I've tried ignorePattern: '**.map' and ignorePattern: '*.map' but they both still gzipped my sourcemaps. I even tried ignorePattern: '\*\*/\*.map', which I lifted from the default filePattern 😂

I ended up working around this by just using filePattern with map removed as an option, but I figured I should open an issue to see if there is anything I can do to help. I would love to add a failing test if someone could at least point me in the right direction.

Issue with compressed files

Hi,

If I use ember-cli-deploy without gzip things work fine.

After installing ember-cli-deploy-gzip the assets now render from the server as strange characters.

For example, my application js file if I go to the URL displays this

�‹��������í}ÛvÛF²è»¿�Á¬��Ë�L‚�Q˜Å�#kì8�ËñXv2{kky5�&	��`\$2Š^ÏóùÆó%§ª»q%H�Œ$‹9Qb	è®nTUWUWõUŽC*…Q`›‘üÄ¢SÛ¥-Ù�ˆ;£j@,ÛS¯é„øþ3b�?¢Aø^�Û$‘í¹²r!Ó¥ï�Q(+2]Lh Z$"ðRUE�ÙNølF]��ˆª‘÷™ºò¥2�]�kkQ%R‚öÍÏ“OÔŒ4ŽÌÛÀói�­ Sþø‘†gž�;TVn®ˆ�Sã›Îm[¡�Kb'�GÉ“öÏóŸßœ¼ýñ„c­ÑeD]«u3÷ÂÈ�çQä�Ï€�[×�†�GW3½…¬¸dACŸ˜Ô�¯tY™Sb�ÝÆ�$�!ü8¢VKæé��GÎ(h�Z�DÇ­Ž�$¨´[ÑÜ�µ�¼ý$ Q�¸7ò¿Õ�ßæ�ú`[²Aµ8¶-�Ò�>‰£¹úž1�’�§�ùÄ4©�©¯�՘̨lÈÔU?œË··míÊs I�ÚjßÂ�J­–d©Å6¬ßò¢¹mwê@kyÁ}5dÒr_b�¬Œò'�
Ä) 

(I've just included the start to give an illustration the actual file is a lot longer).

I notice that if I look in the /tmp/deploy-dist/assets directory this matches how the file looks locally there.

Initially I thought it might be an issue with the server not supporting gzip, so I followed a tutorial online and now when I use a site to check for gzip support it says that GZIP is supported.

So now I'm at a loss as to how to fix this.

gzipped javascript files produce errors

I installed and ember-cli-deploy-gzip run a deploy, my assets are uploaded and they contain errors:

  • Chrome: Uncaught SyntaxError: Invalid or unexpected token
  • Firefox: SyntaxError: illegal character

Both at vendor-***.js:1

My config is here:

	ENV.gzip = {
		ignorePattern: '**/{crossdomain.xml,robots.txt}'
	};

Without the ignorePattern, the browsers also weren't able to parse crossdomain.xml or rather robots.txt

Add an option to only keep gzipped files when smaller

Sometimes you do not really know whether a file compresses good (enough) with gzip so that it will actually become smaller.

It would be nice to introduce an option which will discard the gzipped file if the resulting file is larger, and just keep the original one.

Keep modification time the same as the original file

When using the gzip_static on` directive of nginx, the manual says:

The files can be compressed using the gzip command, or any other compatible one. It is recommended that the modification date and time of original and compressed files be the same.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.