Give the compiled CSS it's own cache pipe so it doesn't conflict with the deferred binding workflow
This commit is contained in:
parent
8cb512e8dd
commit
e7c33467f3
|
|
@ -1,3 +1,6 @@
|
|||
* **Build 160** (2014-11-01)
|
||||
- Various fixes to the Backend Brand settings page.
|
||||
|
||||
* **Build 158** (2014-10-23)
|
||||
- Fixes an issue where new Themes attached to a project were not being installed on update.
|
||||
- Fixes issue where XDebug aborts the thread for maximum function count.
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
?>
|
||||
<?php if (BrandSettings::isConfigured()): ?>
|
||||
<style>
|
||||
<?= BrandSettings::get('rendered_css') ?>
|
||||
<?= BrandSettings::renderCss() ?>
|
||||
</style>
|
||||
<?php endif ?>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
use File;
|
||||
use Lang;
|
||||
use Model;
|
||||
use Cache;
|
||||
use Less_Parser;
|
||||
|
||||
/**
|
||||
|
|
@ -26,6 +27,8 @@ class BrandSettings extends Model
|
|||
'logo' => ['System\Models\File']
|
||||
];
|
||||
|
||||
const CACHE_KEY = 'backend::brand.custom_css';
|
||||
|
||||
// Pumpkin
|
||||
const PRIMARY_LIGHT = '#e67e22';
|
||||
|
||||
|
|
@ -57,9 +60,9 @@ class BrandSettings extends Model
|
|||
$this->secondary_color_dark = self::SECONDARY_DARK;
|
||||
}
|
||||
|
||||
public function beforeValidate()
|
||||
public function afterSave()
|
||||
{
|
||||
$this->rendered_css = self::renderCss();
|
||||
Cache::forget(self::CACHE_KEY);
|
||||
}
|
||||
|
||||
public static function getLogo()
|
||||
|
|
@ -73,6 +76,17 @@ class BrandSettings extends Model
|
|||
}
|
||||
|
||||
public static function renderCss()
|
||||
{
|
||||
if (Cache::has(self::CACHE_KEY)) {
|
||||
return Cache::get(self::CACHE_KEY);
|
||||
}
|
||||
|
||||
$customCss = self::compileCss();
|
||||
Cache::forever(self::CACHE_KEY, $customCss);
|
||||
return $customCss;
|
||||
}
|
||||
|
||||
public static function compileCss()
|
||||
{
|
||||
$parser = new Less_Parser(['compress' => true]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue