Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
web
/
vhosts
/
www.shinegis.mu
/
htdocs
/
functions
/
scssphp
/
bin
/
/srv/data/web/vhosts/www.shinegis.mu/htdocs/functions/scssphp/bin/pscss
#!/usr/bin/env php <?php /** * SCSSPHP * * @copyright 2012-2020 Leaf Corcoran * * @license http://opensource.org/licenses/MIT MIT * * @link http://scssphp.github.io/scssphp */ error_reporting(E_ALL); if (version_compare(PHP_VERSION, '7.2') < 0) { die('Requires PHP 7.2 or above'); } include __DIR__ . '/../scss.inc.php'; use ScssPhp\ScssPhp\Compiler; use ScssPhp\ScssPhp\Exception\SassException; use ScssPhp\ScssPhp\OutputStyle; use ScssPhp\ScssPhp\Version; $style = null; $loadPaths = []; $dumpTree = false; $inputFile = null; $changeDir = false; $encoding = false; $sourceMap = false; $embedSources = false; $embedSourceMap = false; /** * Parse argument * * @param int $i * @param string[] $options * * @return string|null */ function parseArgument(&$i, $options) { global $argc; global $argv; if (! preg_match('/^(?:' . implode('|', (array) $options) . ')=?(.*)/', $argv[$i], $matches)) { return; } if (strlen($matches[1])) { return $matches[1]; } if ($i + 1 < $argc) { $i++; return $argv[$i]; } } $arguments = []; for ($i = 1; $i < $argc; $i++) { if ($argv[$i] === '-?' || $argv[$i] === '-h' || $argv[$i] === '--help') { $exe = $argv[0]; $HELP = <<<EOT Usage: $exe [options] [input-file] [output-file] Options include: --help Show this message [-h, -?] --load-path=PATH Set import path [-I] --sourcemap Create source map file --embed-sources Embed source file contents in source maps --embed-source-map Embed the source map contents in CSS (default if writing to stdout) --style=FORMAT Set the output style (compressed or expanded) [-s, -t] --version Print the version [-v] EOT; exit($HELP); } if ($argv[$i] === '-v' || $argv[$i] === '--version') { exit(Version::VERSION . "\n"); } if ($argv[$i] === '--sourcemap') { $sourceMap = true; continue; } if ($argv[$i] === '--embed-sources') { $embedSources = true; continue; } if ($argv[$i] === '--embed-source-map') { $embedSourceMap = true; continue; } $value = parseArgument($i, array('-t', '-s', '--style')); if (isset($value)) { $style = $value; continue; } $value = parseArgument($i, array('-I', '--load-path')); if (isset($value)) { $loadPaths[] = $value; continue; } if ($argv[$i] && $argv[$i][0] === '-') { fwrite(STDERR, "Error: The option {$argv[$i]} is invalid."); exit(1); } $arguments[] = $argv[$i]; } if (isset($arguments[0]) && file_exists($arguments[0])) { $inputFile = $arguments[0]; $data = file_get_contents($inputFile); } else { $data = ''; while (! feof(STDIN)) { $data .= fread(STDIN, 8192); } } $scss = new Compiler(); if ($loadPaths) { $scss->setImportPaths($loadPaths); } if ($style) { if ($style === OutputStyle::COMPRESSED || $style === OutputStyle::EXPANDED) { $scss->setOutputStyle($style); } else { fwrite(STDERR, "Error: the $style style is invalid.\n"); exit(1); } } $outputFile = isset($arguments[1]) ? $arguments[1] : null; $sourceMapFile = null; if ($sourceMap) { $sourceMapOptions = array( 'outputSourceFiles' => $embedSources, ); if ($embedSourceMap || $outputFile === null) { $scss->setSourceMap(Compiler::SOURCE_MAP_INLINE); } else { $sourceMapFile = $outputFile . '.map'; $sourceMapOptions['sourceMapWriteTo'] = $sourceMapFile; $sourceMapOptions['sourceMapURL'] = basename($sourceMapFile); $sourceMapOptions['sourceMapBasepath'] = getcwd(); $sourceMapOptions['sourceMapFilename'] = basename($outputFile); $scss->setSourceMap(Compiler::SOURCE_MAP_FILE); } $scss->setSourceMapOptions($sourceMapOptions); } try { $result = $scss->compileString($data, $inputFile); } catch (SassException $e) { fwrite(STDERR, 'Error: '.$e->getMessage()."\n"); exit(1); } if ($outputFile) { file_put_contents($outputFile, $result->getCss()); if ($sourceMapFile !== null && $result->getSourceMap() !== null) { file_put_contents($sourceMapFile, $result->getSourceMap()); } } else { echo $result->getCss(); }