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     array(
20         'less' => array(
21             'directory' => "{$rootDir}/roojs1/less/bootstrap",
22             'name' => 'bootstrap'
23         ),
24         'css' => array(
25             'directory' => "{$rootDir}/roojs1/css-bootstrap/",
26             'name' => 'bootstrap'
27         )
28     ),
29     array(
30         'less' => array(
31             'directory' => "{$rootDir}/roojs1/less/roojs-bootstrap",
32             'name' => 'roojs-bootstrap'
33         ),
34         'css' => array(
35             'directory' => "{$rootDir}/roojs1/css-bootstrap/",
36             'name' => 'roojs-bootstrap'
37         )
38     )
39 );
40
41 print_R($files);exit;
42
43 require_once 'HTML/Less.php';
44         
45 $less = new HTML_Less();
46
47 require_once 'HTML/CSS/Minify.php';
48
49 $minify = new HTML_CSS_Minify();
50
51 foreach ($files as $less => $file){
52
53     if(!file_exists($less)){
54         echo "{$less} does not exist...\n";
55         continue;
56     }
57
58     print_R($file);
59     exit;
60     try {
61         
62         $css = "{$file['directory']}{$file['name']}.css";
63         
64         echo "Compiling - {$less} To {$css}\n";
65         
66         $less->compileFile($less, $css);
67         
68         if(!file_exists($css)){
69             echo "Compile failed?!\n";
70             continue;
71         }
72         
73         
74         
75
76     } catch (Exception $ex) {
77         echo "lessphp fatal error: {$ex->getMessage()}\n";
78     }
79     
80
81 }