Skip to content
World Wide Web Server edited this page Jul 4, 2012 · 10 revisions

Download: [url]https://github.com/ericbarnes/ci-minify[/url] Release Date: January 6, 2011 Author: [url=http://ericlbarnes.com]Eric Barnes[/url] Issues: [url=https://github.com/ericbarnes/ci-minify/issues]Bug Tracker[/url]

[h2]Overview[/h2]

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 to 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.

[h2]Installation[/h2] Upload the Minify folder to your libraries folder. This is built using CI2 packages and you must be using CI2.

[h2]Usage[/h2]

Below is an overview of different usages:

[b]Minify JS file[/b]

[code] $this->load->driver('minify'); $file = 'test/js/colorbox.js'; echo $this->minify->js->min($file); [/code]

[b]Minify CSS file[/b]

[code] $this->load->driver('minify'); $file = 'test/css/colorbox.css'; echo $this->minify->css->min($file); [/code]

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

[code] $this->load->driver('minify'); $this->minify->combine_files(array('test/css/calendar.css', 'test/css/colorbox.css'); [/code]

[b]Minify and save a physical file[/b]

[code] $this->load->driver('minify'); $file = 'test/css/colorbox.css'; $contents = $this->minify->js->min($file); $this->minify->save_file($contents, 'test/css/all.css'); [/code]

[b]Minify an entire directory.[/b] The second param is an array of ignored files.

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

Category:Contributions | Category:Contributions::Libraries |

Clone this wiki locally