服务器端自动缩小? [英] Server-side auto-minify?
问题描述
请问有什么办法可以自动运行如下静态内容,然后从自动缓存服务呢?类似的有mod_com preSS / mod_deflate模块的工作? preferably的东西,我可以结合COM pression使用(因为COM pression有一个更明显的好处)。
Is there any way to automatically minify static content and then serve it from a cache automatically? Similar to have mod_compress/mod_deflate work? Preferably something I could use in combination with compression (since compression has a more noticeable benefit).
我的preference的东西,与lighttpd的作品,但我一直没能找到任何东西,这样就可以做到这一点任何Web服务器会很有趣。
My preference is something that works with lighttpd but I haven't been able to find anything, so any web server that can do it would be interesting.
推荐答案
您可以尝试的nginx的第三方剥离模块:
You can try nginx's third party Strip module:
http://wiki.nginx.org/NginxHttpStripModule
您使用的任何模块只是要删除空格。您可以通过使用理解无论你与缩小一个minifier得到一个更好的结果。例如谷歌的关闭JavaScript编译器。
Any module you use is just going to remove whitespace. You'll get a better result by using a minifier that understands whatever you're minifying. e.g. Google's Closure javascript compiler.
这是足够聪明,知道一个变量是什么,使得它的名字更短。用空格卸妆不能做到这一点。
It's smart enough to know what a variable is and make it's name shorter. A whitespace remover can't do that.
我建议你与缩小下线,除非你的网站是非常低的流量。但是,如果你想在你的生活环境来缩小我建议使用nginx的的代理缓存。 (很抱歉,但我没有足够的信誉来发布多个链接)
I'd recommend minifying offline unless your site is very low traffic. But if you want to minify in your live environment I recommend using nginx's proxy cache. (Sorry but I don't have enough reputation to post more than one link)
或者你可以考虑的memcached一个内存缓存或Redis的同样的事情,但磁盘备份。
Or you can look into memcached for an in-memory cache or Redis for the same thing but with disk backup.
这篇关于服务器端自动缩小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!