Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Add gfx-zopfli #449

Merged
merged 3 commits into from
Aug 7, 2018
Merged

Add gfx-zopfli #449

merged 3 commits into from
Aug 7, 2018

Conversation

swojit
Copy link
Contributor

@swojit swojit commented Jul 25, 2018

Fixes #111
After replacing node-nozopfli for its installation issues, Ryan suggested using @gfx/zopfli because it is a fast and universal alternative to the native library.
The behaviour doesn't change at all.
Performance for compression will be slightly slower for gzip compression but given node-zopfli's issues, it's not a dealbreaker.

@swojit swojit changed the title [WIP] Add gfx-zopfli Add gfx-zopfli Jul 25, 2018
@swojit swojit force-pushed the sw/add-gfx-zopfli branch 2 times, most recently from e302bbd to c6a06a2 Compare July 25, 2018 19:08
@swojit swojit requested review from lhorie and rtsao July 25, 2018 19:14
Copy link
Contributor

@KevinGrandon KevinGrandon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Just for future reference, can you add a bit more description to this pull request? I would like to see what the motivation of using this library is, some description of what it does to the behavior and performance profile of a Fusion.js application, and what kind of testing you performed with this.

@swojit
Copy link
Contributor Author

swojit commented Jul 25, 2018

I will definitely keep that in mind. I avoided adding more description because I felt there was nothing more to add after Ryan's description in the referenced issue.
However, for a quick summary, after replacing node-nozopfli for its installation issues, he suggested using @gfx/zopfli because it is a fast and universal alternative to the native library.
The behaviour doesn't change at all.
Performance for compression will be slightly slower for gzip compression but given node-zopfli's issues, it's not a dealbreaker.

@mlmorg
Copy link

mlmorg commented Jul 25, 2018

Do we have tests for these compression plugins to make sure that it is actually compressing the files when requested?

@mlmorg
Copy link

mlmorg commented Jul 25, 2018

Also, please edit the description with the information you provided in your comment so that we can use it as release notes. Thanks!

@swojit
Copy link
Contributor Author

swojit commented Jul 26, 2018

@mlmorg I am not sure if we have tests for the compression plugins. Let me look that up.

@swojit swojit changed the title Add gfx-zopfli [WIP] Add gfx-zopfli Jul 26, 2018
@@ -17,6 +17,7 @@ const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const webpackDevMiddleware = require('../lib/simple-webpack-dev-middleware');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const {
gfxWebpackPlugin,
Copy link
Member

@rtsao rtsao Aug 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think zopfliWebpackPlugin would be a more apt name since it indicates the purpose. It's hard to tell what gfxWebpackPlugin is based on the name.

@swojit swojit changed the title [WIP] Add gfx-zopfli Add gfx-zopfli Aug 7, 2018
@@ -9,6 +9,7 @@
/* eslint-env node */

module.exports = {
zopfliWebpackPlugin: require('./gfx-webpack-plugin'),
Copy link
Contributor

@lhorie lhorie Aug 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gfx is the github handle for the wasm binding lib author. This file should probably be called zopfli-webpack-plugin

files.filter(file => getFileExtension(file) === 'br'),
'brotli works'
);
t.ok(files.filter(file => getFileExtension(file) === 'svg'), 'svg works');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this testing SVGO? If so maybe check that the file contents don't have consecutive spaces

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or I can just compare file sizes?

Copy link
Contributor

@lhorie lhorie Aug 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that works too. As long as it does more than just check for file existence, since IIRC, the file gets created regardless of whether the compression plugin is there or not

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that makes sense.

path.resolve(dir, '.fusion/dist/production/client/'),
(err, files) => {
if (err) throw err;
t.ok(files.filter(file => getFileExtension(file) === 'gz'), 'gzip works');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just use path.extname here

@swojit swojit merged commit 0dc5a4f into master Aug 7, 2018
@swojit swojit deleted the sw/add-gfx-zopfli branch August 7, 2018 21:43
@AlexMSmithCA AlexMSmithCA mentioned this pull request Aug 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants