bibhamrokhanpin/wp-content/plugins/ultimo-wp/paradox/vendor/bin/pscss
2024-04-10 17:46:06 +05:45

67 lines
1.1 KiB
PHP

#!/usr/bin/env php
<?php
error_reporting(E_ALL);
include 'scss.inc.php';
use Leafo\ScssPhp\Compiler;
use Leafo\ScssPhp\Parser;
$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 (compressed, crunched, expanded, or nested)
-T Dump formatted parse tree
EOT;
exit($HELP);
}
if (has("v", "version")) {
exit(Compiler::$VERSION . "\n");
}
$data = "";
while (!feof(STDIN)) {
$data .= fread(STDIN, 8192);
}
if (has("T")) {
$parser = new Parser("STDIN");
print_r($parser->parse($data));
exit();
}
$scss = new Compiler();
if (has("f")) {
$scss->setFormatter('Leafo\\ScssPhp\\' . ucfirst($opts["f"]));
}
echo $scss->compile($data, "STDIN");