buildSDK/less-bootstrap-compiler.php
[roojs1] / buildSDK / less-bootstrap-compiler.php
1 <?php
2
3 $cwd = getcwd();
4
5 if (array_pop(explode('/', $cwd)) !== 'roojs1') {
6     echo "this should be run in roojs1 directory...\n";
7     exit;
8 }
9
10 ini_set('include_path', 
11     dirname(__FILE__) . '/../:' .
12     dirname(__FILE__) . '/../../pear:' .
13     ini_get('include_path')
14 );
15
16 $rootDir = dirname(__FILE__) . '/../..';
17
18 $files = array(
19     "{$rootDir}/roojs1/less/bootstrap/bootstrap.less" => array(
20         'directory' => "{$rootDir}/roojs1/css-bootstrap/",
21         'name' => 'bootstrap'
22     ),
23     "{$rootDir}/roojs1/less/roojs-bootstrap/roojs-bootstrap.less" => array(
24         'directory' => "{$rootDir}/roojs1/css-bootstrap/",
25         'name' => 'roojs-bootstrap'
26     )
27 );
28
29 require_once 'HTML/Less.php';
30         
31 $less = new HTML_Less();
32
33 require_once 'HTML/CSS/Minify.php';
34
35 $minify = new HTML_CSS_Minify();
36
37 foreach ($files as $less => $file){
38
39     if(!file_exists($less)){
40         echo "{$less} does not exist...\n";
41         continue;
42     }
43
44     print_R($file);
45     exit;
46     try {
47         
48         $css = "{$file['directory']}{$file['name']}.css";
49         
50         echo "Compiling - {$less} To {$css}\n";
51         
52         $less->compileFile($less, $css);
53         
54         if(!file_exists($css)){
55             echo "Compile failed?!\n";
56             continue;
57         }
58         
59         
60         
61
62     } catch (Exception $ex) {
63         echo "lessphp fatal error: {$ex->getMessage()}\n";
64     }
65     
66
67 }