Modify compression scheme - no longer compressing index.html due to issues serving compressed file directly with .send on esp32

Removed css from compression plugin - using CSS-in-JS in app
Introduce favicon - add mapping for favicon.ico, was previously sending html response for requests for the favicon
This commit is contained in:
Rick Watson 2018-11-11 17:53:58 +00:00
parent 14820616a6
commit cc7acab37c
3 changed files with 3 additions and 2 deletions

View File

@ -21,11 +21,11 @@ module.exports = function override(config, env) {
const extractTextPlugin = config.plugins.find((plugin) => plugin instanceof ExtractTextPlugin);
extractTextPlugin.filename = "css/[name].[contenthash:4].css";
// add compression plugin, compress javascript, html and css
// add compression plugin, compress javascript
config.plugins.push(new CompressionPlugin({
asset: "[path].gz[query]",
algorithm: "gzip",
test: /\.(js|html|css)$/,
test: /\.(js)$/,
deleteOriginalAssets: true
}));
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -51,6 +51,7 @@ void setup() {
server.serveStatic("/css/", SPIFFS, "/www/css/");
server.serveStatic("/fonts/", SPIFFS, "/www/fonts/");
server.serveStatic("/app/", SPIFFS, "/www/app/");
server.serveStatic("/favicon.ico", SPIFFS, "/www/favicon.ico");
// Serving all other get requests with "/www/index.htm"
// OPTIONS get a straight up 200 response