百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
C

ci-minify

> 编程语言
开源

在 CodeIgniter 中压缩 CSS 和 JS 文件

174 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

在 CodeIgniter 中压缩 CSS 和 JS 文件

CodeIgniter Minify

Please note this project is no longer maintained.

The goal of this project is to provide a simple way to minify and combine js and css files inside a CodeIgniter application. Currently other systems exists but I wanted the compression to be part of my build process. So on deployments I compress and minify all the js and css. Then push off to s3 but this could also be useful to write them to a single file.

Installation

Upload the Minify folder to your libraries folder. This is built using CI2 packages and you must be using CI2.

Usage

Below is an overview of different usages:

Minify JS file

$this->load->driver('minify'); $file = 'test/js/test1.js'; echo $this->minify->js->min($file);

Minify CSS file

$this->load->driver('minify'); $file = 'test/css/test1.css'; echo $this->minify->css->min($file);

Minify String

$this->load->driver('minify'); $content = 'body{ padding:0; margin: 0}'; echo $this->minify->css->min($content);

Minify and combine an array of files. Useful if you need files to be in a certain order.

$this->load->driver('minify'); $files = array('test/css/test2.css', 'test/css/test1.css'); echo $this->minify->combine_files($files, [optionalParams]);

Minify and save a physical file

$this->load->driver('minify'); $file = 'test/css/test1.css'; $contents = $this->minify->css->min($file); $this->minify->save_file($contents, 'test/css/all.css');

Minify an entire directory. The second param is an array of ignored files.

$this->load->driver('minify'); echo $this->minify->combine_directory('test/css/, array('all.css'), [optionalParams]);

Optional Params

combine_files($files, type, [compact], [css_charset]); combine_directory($directory, [ignore], type, [compact], [css_charset]);

Common:

[compact] : bool (TRUE, FALSE). TRUE Compact/compress output, FALSE doesn't compress output (only aggregation) [css_charset] : string (default 'utf-8'). If CSS you can force a starting single charset declaration (when aggregate files) due to the charset pre-removal (for stantdars compliance and Webkit bugfix prevention) set to null or leave empty if JS.

Combine dir:

[ignore] : array with files to ignore

Credits

fsencinas - (https://github.com/fsencinas) JS-Min - (https://github.com/rgrove/jsmin-php)

Issues· 2 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHP

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言