mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 08:12:40 +01:00
9d806b69cb
Summary: this diff does a few, not so exciting things - changes "conpher" to "conpherence" where it snuck into CSS, spritemap, etc -- I believe we now consistently call it conpherence. Feel free to change it, just change it everywhere. :D - puts the widget icons in the right order per M14 - makes the "mobile-only" widgets show the toggles only in the mobile view - also made it so clicking them does nothing for now - removes the tasks widget since we don't want it ...my time is getting chopped up funny (yay puppy) so this is just an attempt at something that can go into the codebase and not make it worse. Next up is making the widgets that show on desktop look right / not say "TODO" Test Plan: played around in Conpherence Reviewers: epriestley, chad Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2530 Differential Revision: https://secure.phabricator.com/D5334
83 lines
2.2 KiB
PHP
Executable file
83 lines
2.2 KiB
PHP
Executable file
#!/usr/bin/env php
|
|
<?php
|
|
|
|
require_once dirname(dirname(__FILE__)).'/__init_script__.php';
|
|
|
|
$args = new PhutilArgumentParser($argv);
|
|
$args->setTagline('regenerate CSS sprite sheets');
|
|
$args->setSynopsis(<<<EOHELP
|
|
**sprites**
|
|
Rebuild CSS sprite sheets.
|
|
|
|
EOHELP
|
|
);
|
|
$args->parseStandardArguments();
|
|
$args->parse(
|
|
array(
|
|
array(
|
|
'name' => 'force',
|
|
'help' => 'Force regeneration even if sources have not changed.',
|
|
),
|
|
));
|
|
|
|
$root = dirname(phutil_get_library_root('phabricator'));
|
|
$webroot = $root.'/webroot/rsrc';
|
|
$webroot = Filesystem::readablePath($webroot);
|
|
|
|
$generator = new CeleritySpriteGenerator();
|
|
|
|
$sheets = array(
|
|
'icon' => $generator->buildIconSheet(),
|
|
'menu' => $generator->buildMenuSheet(),
|
|
'apps' => $generator->buildAppsSheet(),
|
|
'conpherence' => $generator->buildConpherenceSheet(),
|
|
'apps-large' => $generator->buildAppsLargeSheet(),
|
|
'tokens' => $generator->buildTokenSheet(),
|
|
'docs' => $generator->buildDocsSheet(),
|
|
'gradient' => $generator->buildGradientSheet(),
|
|
);
|
|
|
|
list($err) = exec_manual('optipng');
|
|
if ($err) {
|
|
$have_optipng = false;
|
|
echo phutil_console_format(
|
|
"<bg:red> WARNING </bg> `optipng` not found in PATH.\n".
|
|
"Sprites will not be optimized! Install `optipng`!\n");
|
|
} else {
|
|
$have_optipng = true;
|
|
}
|
|
|
|
foreach ($sheets as $name => $sheet) {
|
|
$manifest_path = $root.'/resources/sprite/manifest/'.$name.'.json';
|
|
if (!$args->getArg('force')) {
|
|
if (Filesystem::pathExists($manifest_path)) {
|
|
$data = Filesystem::readFile($manifest_path);
|
|
$data = json_decode($data, true);
|
|
if (!$sheet->needsRegeneration($data)) {
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
|
|
$sheet
|
|
->generateCSS($webroot."/css/sprite-{$name}.css")
|
|
->generateManifest($root."/resources/sprite/manifest/{$name}.json");
|
|
|
|
foreach ($sheet->getScales() as $scale) {
|
|
if ($scale == 1) {
|
|
$sheet_name = "sprite-{$name}.png";
|
|
} else {
|
|
$sheet_name = "sprite-{$name}-X{$scale}.png";
|
|
}
|
|
|
|
$full_path = "{$webroot}/image/{$sheet_name}";
|
|
$sheet->generateImage($full_path, $scale);
|
|
|
|
if ($have_optipng) {
|
|
echo "Optimizing...\n";
|
|
phutil_passthru('optipng -o7 -clobber %s', $full_path);
|
|
}
|
|
}
|
|
}
|
|
|
|
echo "Done.\n";
|