Search code examples
javascriptnode.jspagespeedimage-compressionimage-optimization

Using mod_pagespeed with native node.js server


I've been looking for a solution to optimize images for better performance.

After trying some solutions (like sharp and imagemin, which resulted in never smaller, sometimes bigger files), I am now looking to experiment with Google's pagespeed. Unfortunately, pagespeed seems to only support Apache and Nginx, which I would not like to add to my stack just for image optimization (also, I would prefer making the optimization once on upload, and not on server request, even if cached).

I will be very grateful for any information that might help me implement this in native node.js, and for any other (working!) image optimization recommendations.


Solution

  • I suggest you only use node for dynamic content (e.g: your application server logic).

    For static content, such as images, stylesheets and others... just serve them with a regular web server like nginx. There you can use ngx_pagespeed.