Skip to content

Precompress and optimize static files during build and serve them to browsers#1030

Closed
gmokki wants to merge 1 commit intoHSLdevcom:masterfrom
NitorCreations:serve-precompressed-files
Closed

Precompress and optimize static files during build and serve them to browsers#1030
gmokki wants to merge 1 commit intoHSLdevcom:masterfrom
NitorCreations:serve-precompressed-files

Conversation

@gmokki
Copy link
Copy Markdown

@gmokki gmokki commented Nov 23, 2016

The PR is done - it:

  • follows the style and naming rules (passes npm run lint)
  • doesn't break anything (passes npm run test-local and npm run test-browserstack)
  • any changed files are transformed to ES6

Changes:

  • create precompressed variants of js, css, svg files: gz using zopfli and br using brotli

Currently using forked versions of expressjs/send/negotiator while waiting for the PRs to go through:

@hannesj
Copy link
Copy Markdown
Contributor

hannesj commented Nov 23, 2016

Is there some reason not to use a ready-made plugin like https://webpack.js.org/plugins/compression-webpack-plugin/ for the compression of the assets?

@gmokki
Copy link
Copy Markdown
Author

gmokki commented Nov 24, 2016

Only familiarity of basic unix tools.

I can try to use webpack plugins:

Or maybe I will just leave the image optimizations out of this PR...

@hannesj
Copy link
Copy Markdown
Contributor

hannesj commented Nov 24, 2016

I think the imagemin-zopfli plugin can be added using this

@hannesj
Copy link
Copy Markdown
Contributor

hannesj commented Nov 24, 2016

Also check #1031 where we have included the svgs to be bundled using webpack.

@gmokki gmokki force-pushed the serve-precompressed-files branch from 737e59d to 6d55853 Compare November 25, 2016 16:40
…the browsers.

- create precompressed variants of js, css, svg files: gz using zopfli and br using brotli

Currently using forked versions of expressjs/send/negotiator while waiting for the PRs to go through:
- jshttp/negotiator#49
- pillarjs/send#108
@gmokki gmokki force-pushed the serve-precompressed-files branch from 6d55853 to 9ea280e Compare November 25, 2016 16:42
hannesj added a commit that referenced this pull request Dec 5, 2016
@hannesj
Copy link
Copy Markdown
Contributor

hannesj commented Dec 5, 2016

Implemented the serving using a different express middleware, so we can use the vanilla express version.

See cc2c7f0

@hannesj hannesj closed this Dec 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants