ampproject / ampproject/amp-toolbox

Enable minification on optimizer-express/demo/proxy.js

Open
#244 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
459
Forks
242
PR merge metrics
No merged PRs in 30d

Description

Hello, I need some help on enabling minification on https://github.com/ampproject/amp-toolbox/blob/master/packages/optimizer-express/demo/proxy.js
I tried to use html-minifier with a customTransformer, Middleware, but can't make it works.

I want to use this options from html-minifier:
```
const minify = require('html-minifier').minify;
minify(content, {
collapseWhitespace: true,
minifyCSS: true,
removeComments: true,
});
```
I also tried https://www.npmjs.com/package/express-minify-html as suggested by @torch2424 on slack

Contributor guide

Open the contributing guide

Research direction

Start with optimizer-express/demo/proxy.js and inspect how the demo proxy handles HTML responses. Compare that flow with the html-minifier options and express-minify-html approach described in the issue; done means the proxy applies the requested whitespace, CSS, and comment minification to served HTML without breaking responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, javascript
Domain
backend, web-dev
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.