<?php
-echo getcwd() . "\n";
+$cwd = getcwd();
-echo __DIR__;
\ No newline at end of file
+if (array_pop(explode('/', $cwd)) !== 'roojs1') {
+ echo "this should be run in roojs1 directory...\n";
+ exit;
+}
+
+ini_set('include_path',
+ dirname(__FILE__) . '/../:' .
+ dirname(__FILE__) . '/../../pear:' .
+ ini_get('include_path')
+);
+
+$rootDir = dirname(__FILE__) . '/../..';
+
+$files = array(
+ "{$rootDir}/roojs1/less/bootstrap/bootstrap.less" => array(
+ 'baseDir' => "/tmp/css-compiled", //"{$rootDir}/roojs1/css-bootstrap",
+ 'name' => 'bootstrap.css',
+ 'minify' => 'bootstrap.min.css'
+ ),
+ "{$rootDir}/roojs1/less/roojs-bootstrap/roojs-bootstrap.less" => array(
+ 'baseDir' => "/tmp/css-compiled", //"{$rootDir}/roojs1/css-bootstrap",
+ 'name' => 'roojs-bootstrap-debug.css',
+ 'minify' => 'roojs-bootstrap.css'
+ )
+);
+
+require_once 'HTML/Less.php';
+
+$less = new HTML_Less();
+
+//require_once 'HTML/CSS/Minify.php';
+//
+//$minify = new HTML_CSS_Minify();
+
+$minify = array();
+
+foreach ($files as $src => $file){
+
+ if(!file_exists($src)){
+ echo "{$less} does not exist...\n";
+ continue;
+ }
+
+ try {
+
+ $css = "{$file['baseDir']}/{$file['name']}";
+
+ echo "Compiling - {$src} To {$css}\n";
+
+ $less->compileFile($src, $css);
+
+ if(!file_exists($css)){
+ echo "Compile failed?!\n";
+ continue;
+ }
+
+ $minify[$file['mimify']] = $css;
+
+ } catch (Exception $ex) {
+ echo "lessphp fatal error: {$ex->getMessage()}\n";
+ }
+
+}
+
+print_R($minify);
\ No newline at end of file