CachePreprocessCSS.php in Site Audit 8.3
File
src/Plugin/SiteAuditCheck/CachePreprocessCSS.php
View source
<?php
namespace Drupal\site_audit\Plugin\SiteAuditCheck;
use Drupal\site_audit\Plugin\SiteAuditCheckBase;
class CachePreprocessCSS extends SiteAuditCheckBase {
public function getResultFail() {
return $this
->t('CSS aggregation and compression is not enabled!');
}
public function getResultInfo() {
return $this
->getResultFail();
}
public function getResultPass() {
return $this
->t('CSS aggregation and compression is enabled.');
}
public function getResultWarn() {
}
public function getAction() {
if (!in_array($this->score, [
SiteAuditCheckBase::AUDIT_CHECK_SCORE_PASS,
])) {
return $this
->t('Go to /admin/config/development/performance and check "Aggregate and compress CSS files".');
}
}
public function calculateScore() {
$config = \Drupal::config('system.performance')
->get('css.preprocess');
if ($config) {
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_PASS;
}
if (site_audit_env_is_dev()) {
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_INFO;
}
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_FAIL;
}
}