The original LessCss for ruby: http://lesscss.org/
The port to php called LessPhp : http://leafo.net/lessphp/docs/
And now, the Codeigniter library wrapper for LessPhp (alpha):
(download the attached zip file)
EDIT: I accidentally put the documentation from the non-CI version in the topic ($less = new LessCss(); ). I updated it. Now it is the CI version ($this->lesscss->... ).
Usage
//figure out the paths to our folders relative to codeigniter index.php
//where test.less is
$relativePath_less = 'someSubfolder/css/less';
//where you want to put the converted test.css file
$relativePath_css = 'someSubfolder/css';
//where Less.php is
$relativePath_lessphp = "someSubfolder/css/LessCss/LessCss.php";
//load the LessCss library:
$this->load->library('LessCss/lesscss');
//tell it where the folders are:
$this->lesscss->init($relativePath_less,$relativePath_css);
//OR set them in the codeigniter main config file:
$config['less_css_dir_dot_less'] = "css";
$config['less_css_dir_dot_css'] = "css/less";
//if no errors, then the output of this code should be 'test.css':
echo $this->lesscss->compile('test.less');
//output:
test.css
//so typical usage is:
<link type="text/css" href="css/<?php echo $this->lesscss->compile('myStyle.less'); ?>" rel="stylesheet">
//this will output:
<link type="text/css" href="css/myStyle.css" rel="stylesheet">
//in the background, $this->lesscss->compile() has:
//checked if 'myStyle.less' needs to be compiled,
//and compiled it if necesary, so 'myStyle.css' is always up to date