Skip to content
Permalink
Browse files

fixes #10173 to not compile css files as less

  • Loading branch information...
tsteur committed Jun 1, 2016
1 parent 451f6f7 commit 00545861fd4450ae1a763e9eefcaa2d9ba674208
@@ -24,7 +24,7 @@ abstract class UIAssetMerger
/**
* @var string
*/
private $mergedContent;
protected $mergedContent;
/**
* @var UIAssetCacheBuster
@@ -100,7 +100,7 @@ protected function getConcatenatedAssets()
return $this->mergedContent;
}
private function concatenateAssets()
protected function concatenateAssets()
{
$mergedContent = '';
@@ -12,6 +12,7 @@
use lessc;
use Piwik\AssetManager\UIAsset;
use Piwik\AssetManager\UIAssetMerger;
use Piwik\Common;
use Piwik\Piwik;
class StylesheetUIAssetMerger extends UIAssetMerger
@@ -21,6 +22,11 @@ class StylesheetUIAssetMerger extends UIAssetMerger
*/
private $lessCompiler;
/**
* @var UIAsset[]
*/
private $cssAssetsToReplace = array();
public function __construct($mergedAsset, $assetFetcher, $cacheBuster)
{
parent::__construct($mergedAsset, $assetFetcher, $cacheBuster);
@@ -33,9 +39,50 @@ protected function getMergedAssets()
// note: we're using setImportDir on purpose (not addImportDir)
$this->lessCompiler->setImportDir(PIWIK_USER_PATH);
$concatenatedAssets = $this->getConcatenatedAssets();
return $this->lessCompiler->compile($concatenatedAssets);
$compiled = $this->lessCompiler->compile($concatenatedAssets);
foreach ($this->cssAssetsToReplace as $asset) {
$cssPath = $asset->getAbsoluteLocation();
$cssContent = $this->processFileContent($asset);
$compiled = str_replace($this->getImportStatementForReplacement($cssPath), $cssContent, $compiled);
}
$this->mergedContent = $compiled;
$this->cssAssetsToReplace = array();
return $compiled;
}
private function getImportStatementForReplacement($path)
{
return '@import url("replace'. $path .'");';
}
protected function concatenateAssets()
{
$mergedContent = '';
foreach ($this->getAssetCatalog()->getAssets() as $uiAsset) {
$uiAsset->validateFile();
try {
$path = $uiAsset->getAbsoluteLocation();
} catch (Exception $e) {
$path = null;
}
if (!empty($path) && Common::stringEndsWith($path, '.css')) {
$mergedContent .= "\n" . $this->getImportStatementForReplacement($path) . "\n";
$this->cssAssetsToReplace[] = $uiAsset;
} else {
$content = $this->processFileContent($uiAsset);
$mergedContent .= $this->getFileSeparator() . $content;
}
}
$this->mergedContent = $mergedContent;
}
/**
* @return lessc
* @throws Exception
@@ -217,11 +217,3 @@ a.Piwik_Popover_Error_Back {
margin:0;
font-size:18px;
}

/** Can be removed once https://github.com/piwik/piwik/issues/10173 is fixed */
.modal.modal-fixed-footer .modal-content {
height: ~"calc(100% - 56px)"
}
.side-nav {
height: ~"calc(100% + 60px)"
}
@@ -239,7 +239,7 @@ PageRenderer.prototype._load = function (url, callback) {
this._resourcesRequested = {};

var self = this;
this.webpage.open(url, {}, function (status) {
this.webpage.open(url, function (status) {

if (VERBOSE) {
self._logMessage('Webpage open event');

0 comments on commit 0054586

Please sign in to comment.
You can’t perform that action at this time.