C0nw0nk / Nginx-Lua-minification-library

A compression and minification library to minify static or dynamic assets like HTML PHP outputs CSS style sheets JS Javascript all text/html or plain text mime types that nginx can output that the browser will read so they are small compressed and have white space removed as well as helping reduce bandwidth consumption since the files served from nginx webserver are now smaller.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bad performance in large files

Yokutto opened this issue · comments

commented

Hi,
I noticied a bad performance from lua parsing a very large javascript file (more than 1Mb).

So I wanted to ask if it would be possible to use a way to cache a file based on HTTP cache headers, like cloudflare CDN does.

If you want to see what i'm saying, go to: https://cdn.aninya.com/index.js (Use a query string to bypass CDN cache).

Note: I also use pagespeed for optimization, but he don't impact on minification performance

It is possible but it might be better to be a seperate library or extension to do so users have the option of uncached and cached minification on files they expect to change.

Open to opinions on it though if people want it intergrated with the main script then so be it :)

Might require users Nginx configs to be running the following.

https://github.com/openresty/lua-nginx-module#lua_shared_dict

lua_shared_dict

Just to store the cached Minified mime types by the Lua script.