3 Star 5 Fork 4

lanrenwo / icombo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

iCombo: 合并CSS、JS文件、减少连接数

iCombo提供比Minify、concat模块更好的并发性能,iCombo,你值得拥有!
iCombo已经在百万PV的网站正常使用,你值得试试!
同时欢迎你提出宝贵建议。

[特性]
1、兼容minify的 f 参数,如 ?f=1.css,2.css,3.css
2、可以将图片的相对路径,替换为域名的方式
3、压缩CSS的代码(删除注释、换行、精简颜色等)
4、一键删除服务器的所有缓存文件
5、错误日志记录

[环境要求]
Nginx + Ngx_lua + LUAJIT

[安装/配置]
一、安装lua posix库:

# wget http://git.alpinelinux.org/cgit/luaposix/snapshot/luaposix-5.1.8.tar.bz2
# tar jxvf luaposix-5.1.8.tar.bz2
# cd luaposix-5.1.8
# vi Makefile
  LUAINC=         $(PREFIX)/include/luajit-2.0
# make CC=gcc
# make install CC=gcc

二、配置nginx:
1、将icombo目录,放至/usr/local/nginx/conf/目录
2、修改配置文件:

 http {
    location = / {
        set $cache_dir "/dev/shm/icombo/";
        set $css_trim "on";
        set $max_files 20;
        set $admin_ip "192.168.8.63,192.168.8.181";
        content_by_lua_file /usr/local/nginx/conf/icombo/icombo.lua;
    }
    location /icombo_sub/ {
        alias /dev/shm/icombo/;
        internal;
    }
 }

三、访问URL:
http://x.x.x.x/?f=static/index/header.css,static/index/footer.css

四、常用功能
1、自定义CSS、JS目录(默认在当前目录)

set $css_dir "include/css/";
set $js_dir  "include/javascript/";

2、多个图片路径替换:
采用 | 分隔,替换多个路径:

set $css_replace "../../../images,http://images.xxx.com|../../../ck,http://images.xxx.com";

3、开启清除CSS注释功能:

set $css_trim "on";

4、根据CSS目录,自动替换图片相对路径:

set $css_path_auto "images/";

5、设置合并的最大文件数:

set $max_files 20;

6、删除服务器的所有缓存文件(慎用):
配置$admin_ip:

set $admin_ip "192.168.8.63,192.168.8.181";  

链接增加&c=1即可,页面内容显示sucess即成功:
http://x.x.x.x/?f=static/index/header.css,static/index/footer.css&c=1

[感谢]
感谢Nginx http://nginx.org
感谢LuaJIT http://luajit.org/
感谢春哥 http://www.weibo.com/agentzh

The MIT License (MIT) Copyright (c) 2014 lanrenwo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

iCombo类似于PHP的minify,Lua开发,可以合并CSS、JS文件,减少请求数。 展开 收起
Lua
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Lua
1
https://gitee.com/phpcleps/icombo.git
git@gitee.com:phpcleps/icombo.git
phpcleps
icombo
icombo
master

搜索帮助