Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2890856
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
9 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/infrastructure/celerity/CelerityResourceTransformer.php b/src/infrastructure/celerity/CelerityResourceTransformer.php
index 922f41dab8..249f337182 100644
--- a/src/infrastructure/celerity/CelerityResourceTransformer.php
+++ b/src/infrastructure/celerity/CelerityResourceTransformer.php
@@ -1,122 +1,147 @@
<?php
/**
* @group celerity
*/
final class CelerityResourceTransformer {
private $minify;
private $rawResourceMap;
private $celerityMap;
private $translateURICallback;
+ private $currentPath;
public function setTranslateURICallback($translate_uricallback) {
$this->translateURICallback = $translate_uricallback;
return $this;
}
public function setMinify($minify) {
$this->minify = $minify;
return $this;
}
public function setRawResourceMap(array $raw_resource_map) {
$this->rawResourceMap = $raw_resource_map;
return $this;
}
public function setCelerityMap(CelerityResourceMap $celerity_map) {
$this->celerityMap = $celerity_map;
return $this;
}
/**
* @phutil-external-symbol function jsShrink
*/
public function transformResource($path, $data) {
$type = self::getResourceType($path);
switch ($type) {
case 'css':
+ $data = $this->replaceCSSVariables($path, $data);
$data = preg_replace_callback(
'@url\s*\((\s*[\'"]?.*?)\)@s',
nonempty(
$this->translateURICallback,
array($this, 'translateResourceURI')),
$data);
break;
}
if (!$this->minify) {
return $data;
}
// Some resources won't survive minification (like Raphael.js), and are
// marked so as not to be minified.
if (strpos($data, '@'.'do-not-minify') !== false) {
return $data;
}
switch ($type) {
case 'css':
// Remove comments.
$data = preg_replace('@/\*.*?\*/@s', '', $data);
// Remove whitespace around symbols.
$data = preg_replace('@\s*([{}:;,])\s*@', '\1', $data);
// Remove unnecessary semicolons.
$data = preg_replace('@;}@', '}', $data);
// Replace #rrggbb with #rgb when possible.
$data = preg_replace(
'@#([a-f0-9])\1([a-f0-9])\2([a-f0-9])\3@i',
'#\1\2\3',
$data);
$data = trim($data);
break;
case 'js':
// If `jsxmin` is available, use it. jsxmin is the Javelin minifier and
// produces the smallest output, but is complicated to build.
if (Filesystem::binaryExists('jsxmin')) {
$future = new ExecFuture('jsxmin __DEV__:0');
$future->write($data);
list($err, $result) = $future->resolve();
if (!$err) {
$data = $result;
break;
}
}
// If `jsxmin` is not available, use `JsShrink`, which doesn't compress
// quite as well but is always available.
$root = dirname(phutil_get_library_root('phabricator'));
require_once $root.'/externals/JsShrink/jsShrink.php';
$data = jsShrink($data);
break;
}
return $data;
}
public static function getResourceType($path) {
return last(explode('.', $path));
}
public function translateResourceURI(array $matches) {
$uri = trim($matches[1], "'\" \r\t\n");
if ($this->rawResourceMap) {
if (isset($this->rawResourceMap[$uri]['uri'])) {
$uri = $this->rawResourceMap[$uri]['uri'];
}
} else if ($this->celerityMap) {
$info = $this->celerityMap->lookupFileInformation($uri);
if ($info) {
$uri = $info['uri'];
}
}
return 'url('.$uri.')';
}
+ private function replaceCSSVariables($path, $data) {
+ $this->currentPath = $path;
+ return preg_replace_callback(
+ '/{\$([^}]+)}/',
+ array($this, 'replaceCSSVariable'),
+ $data);
+ }
+
+ public function replaceCSSVariable($matches) {
+ static $map = array(
+ 'red' => '#c0392b',
+ );
+
+ $var_name = $matches[1];
+ if (empty($map[$var_name])) {
+ $path = $this->currentPath;
+ throw new Exception(
+ "CSS file '{$path}' has unknown variable '{$var_name}'.");
+ }
+
+ return $map[$var_name];
+ }
+
}
diff --git a/webroot/rsrc/css/layout/phabricator-timeline-view.css b/webroot/rsrc/css/layout/phabricator-timeline-view.css
index b75413b941..e210c39376 100644
--- a/webroot/rsrc/css/layout/phabricator-timeline-view.css
+++ b/webroot/rsrc/css/layout/phabricator-timeline-view.css
@@ -1,259 +1,259 @@
/**
* @provides phabricator-timeline-view-css
*/
.phabricator-timeline-view {
background: #eeedf0;
}
.phabricator-timeline-event-view {
border-width: 0 0 0 3px;
border-style: solid;
border-color: #c0c5d1;
}
.device-desktop .phabricator-timeline-event-view {
margin-left: 80px;
margin-right: 12px;
position: relative;
}
.device-desktop .phabricator-timeline-spacer {
min-height: 20px;
border-right-width: 0;
}
.device-desktop .phabricator-timeline-major-event,
.device-desktop .phabricator-timeline-minor-event {
border-right-width: 3px;
}
.device-desktop .phabricator-timeline-wedge {
border-bottom: 3px solid #c0c5d1;
position: absolute;
width: 20px;
}
.phabricator-timeline-content {
background: #ffffff;
border-style: solid;
border-color: #c0c5d1;
border-width: 1px 0;
}
.phabricator-timeline-title {
line-height: 28px;
min-height: 28px;
position: relative;
}
.phabricator-timeline-title a {
font-weight: bold;
}
.device-desktop .phabricator-timeline-wedge {
left: -20px;
}
.device-desktop .phabricator-timeline-major-event .phabricator-timeline-wedge {
top: 24px;
}
.device-desktop .phabricator-timeline-minor-event .phabricator-timeline-wedge {
top: 12px;
}
.phabricator-timeline-image {
background: #c0c5d1;
background-repeat: no-repeat;
position: absolute;
}
.device-desktop .phabricator-timeline-major-event .phabricator-timeline-image {
width: 50px;
height: 50px;
top: 0px;
left: -70px;
}
.device-desktop .phabricator-timeline-minor-event .phabricator-timeline-image {
width: 30px;
height: 30px;
background-size: 30px auto;
left: -45px;
}
.phabricator-timeline-major-event .phabricator-timeline-title {
background: #f7f7f7;
min-height: 29px;
}
.phabricator-timeline-title {
padding: 0 5px;
overflow-x: auto;
}
.phabricator-timeline-title-with-icon {
padding-left: 33px;
}
.phabricator-timeline-major-event .phabricator-timeline-content
.phabricator-timeline-core-content {
padding: 10px 15px;
}
.phabricator-timeline-core-content {
overflow-x: auto;
}
.device .phabricator-timeline-event-view {
min-height: 23px;
position: relative;
margin-left: 3px;
margin-right: 3px;
border-right-width: 3px;
border-right-style: solid;
}
.device .phabricator-timeline-image {
display: none;
}
.device .phabricator-timeline-spacer {
min-height: 8px;
border-width: 0;
}
.phabricator-timeline-icon-fill {
position: absolute;
width: 30px;
height: 30px;
background-color: #c0c5d1;
top: 0;
left: -3px;
}
.phabricator-timeline-icon {
position: absolute;
left: 8px;
top: 8px;
height: 14px;
width: 14px;
}
.phabricator-timeline-extra, .phabricator-timeline-extra a {
font-size: 11px;
font-weight: normal;
color: #888888;
}
.device-desktop .phabricator-timeline-extra {
float: right;
}
.device .phabricator-timeline-extra {
display: block;
text-align: right;
line-height: 16px;
}
.phabricator-timeline-red .phabricator-timeline-border {
- border-color: #c0392b;
+ border-color: {$red};
}
.phabricator-timeline-orange .phabricator-timeline-border {
border-color: #d35400;
}
.phabricator-timeline-yellow .phabricator-timeline-border {
border-color: #f1c40f;
}
.phabricator-timeline-green .phabricator-timeline-border {
border-color: #27ae60;
}
.phabricator-timeline-sky .phabricator-timeline-border {
border-color: #3498db;
}
.phabricator-timeline-blue .phabricator-timeline-border {
border-color: #2980b9;
}
.phabricator-timeline-indigo .phabricator-timeline-border {
border-color: #c6539d;
}
.phabricator-timeline-violet .phabricator-timeline-border {
border-color: #8e44ad;
}
.phabricator-timeline-grey .phabricator-timeline-border {
border-color: #888;
}
.phabricator-timeline-black .phabricator-timeline-border {
border-color: #333;
}
.phabricator-timeline-red .phabricator-timeline-icon-fill {
- background-color: #c0392b;
+ background-color: {$red};
}
.phabricator-timeline-orange .phabricator-timeline-icon-fill {
background-color: #d35400;
}
.phabricator-timeline-yellow .phabricator-timeline-icon-fill {
background-color: #f1c40f;
}
.phabricator-timeline-green .phabricator-timeline-icon-fill {
background-color: #27ae60;
}
.phabricator-timeline-sky .phabricator-timeline-icon-fill {
background-color: #3498db;
}
.phabricator-timeline-blue .phabricator-timeline-icon-fill {
background-color: #2980b9;
}
.phabricator-timeline-indigo .phabricator-timeline-icon-fill {
background-color: #c6539d;
}
.phabricator-timeline-violet .phabricator-timeline-icon-fill {
background-color: #8e44ad;
}
.phabricator-timeline-grey .phabricator-timeline-icon-fill {
background-color: #888;
}
.phabricator-timeline-black .phabricator-timeline-icon-fill {
background-color: #333;
}
.phabricator-timeline-shell.anchor-target {
background: rgba(255, 255, 0, 0.50);
box-shadow: 0 0 3px 6px rgba(255, 255, 0, 0.50);
}
.phabricator-timeline-preview-header {
background: #e0e3ec;
color: #444444;
padding: 4px 1.25%;
border: solid #c0c5d1 1px 0;
}
.phabricator-timeline-change-details {
padding: 10px 0;
border-style: solid;
border-color: #efefef;
border-width: 1px 0;
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Jan 19, 14:14 (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1125398
Default Alt Text
(9 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment