forked from Martin-Gleiss/smartvisu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.php
84 lines (67 loc) · 1.93 KB
/
make.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
* -----------------------------------------------------------------------------
* @package smartVISU
* @author Martin Gleiß
* @copyright 2012 - 2015
* @license GPL [http://www.gnu.de]
* -----------------------------------------------------------------------------
*/
// get config-variables
require_once 'lib/includes.php';
require_once const_path_system.'functions.php';
require_once 'vendor/google.closure/smart_closure.php';
echo "<pre>\n";
echo str_repeat(" ", 69)."smart[VISU]\n";
echo str_repeat(" ", 68).date('H:i, d.m')."\n";
echo str_repeat("-", 80)."\n\n";
compile("lib/base/base.js");
echo "\n";
compile("lib/base/jquery.mobile.slider.js");
echo "\n";
echo "\n";
compile("widgets/widget.js");
echo "\n";
compile("widgets/animation.js");
echo "\n";
echo "\n";
compile_dir("designs");
echo "\n";
compile_dir("driver");
echo "\n";
echo str_repeat("-", 80)."\n\n";
echo "\n</pre>";
function compile_dir($dir) {
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
if(strlen($filename) < 3 || substr($filename, -3) != '.js')
continue;
if(strlen($filename) >= 7 && substr($filename, -7) == '.min.js')
continue;
if(substr($filename, 0, 1) == '_')
continue;
compile($dir.'/'.$filename);
echo "\n";
}
}
function compile($file)
{
echo "<b>".$file."</b>\n";
if (is_file($file))
{
// compile it
$c = new smartClosure();
$result = $c->add($file)->simpleMode()->_compile();
// write it
$compiled = substr($result, strpos($result, '*/') + 3);
$compiled = "/* smartVISU, Martin Gleiß, 2012 - 2015, GPL [http://www.gnu.de] */\n".$compiled;
filewrite(substr($file, 0, -3).".min.js", $compiled);
// status
$pos = strpos($result, '\'') + 1;
echo str_replace(" Size", "", str_replace("\\n", ", ", substr($result, $pos + 50, strpos($result, ');') - $pos - 1 - 104)));
echo "\n";
}
else
echo "...not found!\n";
}
?>