forked from leafo/scssphp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpscss
executable file
·53 lines (41 loc) · 886 Bytes
/
pscss
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
#!/usr/bin/env php
<?php
error_reporting(E_ALL);
require "scss.inc.php";
$opts = getopt('hvTf:', array('help', 'version'));
function has() {
global $opts;
foreach (func_get_args() as $arg) {
if (isset($opts[$arg])) return true;
}
return false;
}
if (has("h", "help")) {
$exe = array_shift($argv);
$HELP = <<<EOT
Usage: $exe [options] < input-file
Options include:
-h, --help Show this message
-v, --version Print the version
-f=format Set the output format
-T Dump formatted parse tree
EOT;
exit($HELP);
}
if (has("v", "version")) {
exit(scssc::$VERSION . "\n");
}
$data = "";
while (!feof(STDIN)) {
$data .= fread(STDIN, 8192);
}
if (has("T")) {
$parser = new scss_parser("STDIN");
print_r($parser->parse($data));
exit();
}
$scss = new scssc();
if (has("f")) {
$scss->setFormatter($opts["f"]);
}
echo $scss->compile($data, "STDIN");