protected function writeCssFile($key) { $this->makeFilePath($this->filename[$key], $key); if (!file_exists($this->completeFilePath[$key])) { if (!is_dir(dirname($this->completeFilePath[$key]))) { mkdir(dirname($this->completeFilePath[$key]), 0777, true); } if ($this->config['CssMinify']) { $cssmin = new \CSSmin(); $this->content[$key] = $cssmin->run($this->content[$key]); } if ($this->config['CssSpritify']) { $spritify = new Spritify($this->config); $this->content[$key] = $spritify->run($this->content[$key]); } File::put_content($this->completeFilePath[$key], $this->content[$key]); } }
public function getCssInline($htmlHeaders, $attributes) { $file = 'inline' . DIRECTORY_SEPARATOR . md5($attributes['value']) . '.css'; $completeFilePath = $this->config['BasePath'] . $this->config['PublicCacheDir'] . $file; if (!file_exists($completeFilePath)) { if (!is_dir(dirname($completeFilePath))) { mkdir(dirname($completeFilePath), 0777, true); } if ($this->config['CssMinify']) { $cssmin = new \CSSmin(); $attributes['value'] = $cssmin->run($attributes['value']); } if ($this->config['CssSpritify']) { $spritify = new Spritify($this->config); $attributes['value'] = $spritify->run($attributes['value']); } File::put_content($completeFilePath, $attributes['value']); } $attributes['href'] = Url::normalizeUrl($this->config['URIBasePath'] . $this->config['PublicCacheDir'] . $file); unset($attributes['value']); if (!$attributes['rel']) { $attributes['rel'] = 'stylesheet'; } if ($this->config['CSSSeparateInline']) { $attributes['media'] = $attributes['media'] ? $attributes['media'] . '_inline' : 'all_inline'; } return $attributes; }