Compiles to CSS.

@return string
543744
public function to_css() {
        $content = implode(';', $this->scssprepend);
        if (!empty($this->scssfile)) {
            $content .= file_get_contents($this->scssfile);
        }
        $content .= implode(';', $this->scsscontent);
        return $this->compile($content);
    }
904715
public function getCss()
    {
        if (isset($this->_themeConfig['css'])) {
            return array_merge($this->_themeConfig['css'], $this->_data['css']);
        } else {
            return $this->_data['css'];
        }
    }
1327152
public function getStyle(): string
    {
        $values = $this->options;
        if ($this->bgColor > 0) {
            array_unshift($values, $this->bgColor);
        }

        if ($this->fgColor > 0) {
            array_unshift($values, $this->fgColor);
        }

        return implode(';', $values);
    }
561430
public function get_css_content() {

        $csscontent = '';
        foreach ($this->get_css_files(false) as $type => $value) {
            foreach ($value as $identifier => $val) {
                if (is_array($val)) {
                    foreach ($val as $v) {
                        $csscontent .= file_get_contents($v) . "\n";
                    }
                } else {
                    if ($type === 'theme' && $identifier === self::SCSS_KEY) {
                        // We need the content from SCSS because this is the SCSS file from the theme.
                        if ($compiled = $this->get_css_content_from_scss(false)) {
                            $csscontent .= $compiled;
                        } else {
                            // The compiler failed so default back to any precompiled css that might
                            // exist.
                            $csscontent .= $this->get_precompiled_css_content();
                        }
                    } else if ($type === 'theme' && $identifier === $this->lessfile) {
                        // We need the content from LESS because this is the LESS file from the theme.
                        $csscontent .= $this->get_css_content_from_less(false);
                    } else {
                        $csscontent .= file_get_contents($val) . "\n";
                    }
                }
            }
        }
        $csscontent = $this->post_process($csscontent);
        $csscontent = core_minify::css($csscontent);

        return $csscontent;
    }
1066849
private function getStylesheetsMaxAge()
    {
        if (is_null($this->cssPath)) {
            $this->findPaths();
            $this->checkPaths();
        }
        return $this->getFilesMaxAge($this->cssPath, array('*.css'));
    }
1120087
public function getCss()
    {
        $parser = new \Less_Parser(
            array(
                'cache_dir' => Config::get('concrete.cache.directory'),
                'compress' => (bool) Config::get('concrete.theme.compress_preprocessor_output'),
                'sourceMap' => !Config::get('concrete.theme.compress_preprocessor_output') && (bool) Config::get('concrete.theme.generate_less_sourcemap'),
            )
        );
        $parser = $parser->parseFile($this->file, $this->sourceUriRoot);
        if (isset($this->valueList) && $this->valueList instanceof \Concrete\Core\StyleCustomizer\Style\ValueList) {
            $variables = array();
            foreach ($this->valueList->getValues() as $value) {
                $variables = array_merge($value->toLessVariablesArray(), $variables);
            }
            $parser->ModifyVars($variables);
        }
        $css = $parser->getCss();

        return $css;
    }
513990
public function cmsPageCss()
    {
        $currentView = $this->currentViewHelper->getCurrentView();
        if (!$currentView || !$this->viewCssBuilder->cssFileExists($currentView)) {
            return '<!-- CSS File not found -->';
        }

        return sprintf(
            '<link href="%s" rel="stylesheet" type="text/css" rel="stylesheet"/>',
            $this->viewCssBuilder->getHref($currentView)
        );
    }
284321
public function renderStyles()
    {
        $this->loadPackageCss();

        if (empty($this->styles)) {
            return PHP_EOL;
        }

        $assets = [];

        foreach ($this->sort($this->styles) as $handle => $data) {
            $assets[] = $this->getCss($handle);
        }

        return implode(PHP_EOL, $assets);
    }
943814
public function get_precompiled_css_content() {
        $configs = [$this] + $this->parent_configs;
        $css = '';

        foreach ($configs as $config) {
            if (isset($config->precompiledcsscallback)) {
                $function = $config->precompiledcsscallback;
                if (function_exists($function)) {
                    $css .= $function($this);
                }
            }
        }
        return $css;
    }
755332
public function compile()
    {
        //Unificamos ficheros para que no se retarde mucho el proceso
        $this->files = array_unique($this->files);
        switch ($this->type) {
            default:
            case "js":
                $this->compileJs();
                break;
            case "css":
                $this->compileCss();
                break;
        }

        return $this;
    }
1298682
private function compile()
    {
        $commands = array_keys($this->commands);
        $values = $this->getArrayValues(array_values($this->commands));

        $origSource = $this->source;

        $vs = '%s';
        $bin = $this->converter;
        $type = preg_replace('#^image/#', null, $this->getInfo('type'));

        $this->tmpFile = $this->getTempFile();

        if ($this->isMultipartImage()) {

            $this->intermediate = $this->getTempFile($type);
            $this->source = $this->intermediate;

        }

        array_unshift($values, sprintf('%s:%s', $type, escapeshellarg($this->source)));

        array_unshift($values, $bin);

        array_unshift($commands, $vs);
        array_unshift($commands, $vs);

        if ($this->isMultipartImage()) {

            array_unshift(
                $values,
                sprintf(
                    '%s %s:%s -coalesce %s %s',
                    $this->converter,
                    $type,
                    $origSource,
                    $this->intermediate,
                    PHP_EOL
                )
            );
            array_unshift($commands, $vs);
        }

        array_push($values, sprintf('%s:%s', $this->getOutputType(), $this->tmpFile));
        array_push($commands, $vs);

        $cmd = implode(' ', $commands);

        $this->source = $origSource;

        return vsprintf($cmd, $values);
    }
1036233
protected function selfMin()
    {
        if (!$this->css) {
            return $this->css;
        }
        $static = &static::$static[__FUNCTION__.'_map'];

        if (!isset($static['replace'], $static['with'], $static['colors'])) {
            $de_spacifiables = array(
                '{',
                '}',
                '!=',
                '|=',
                '^=',
                '$=',
                '*=',
                '~=',
                '=',
                '~',
                ';',
                ',',
                '>',
            );
            $de_spacifiables = array_map(
                function ($string) {
                    return preg_quote($string, '/');
                },
                $de_spacifiables
            );
            $de_spacifiables = implode('|', $de_spacifiables);

            $static['replace'] = array(
                'comments'        => '/\/\*.*?\*\//s',
                'line_breaks'     => '/['."\r\n".']+/',
                'extra_spaces'    => '/\s{2,}/',
                'de_spacifiables' => '/ *('.$de_spacifiables.') */',
                'unnecessary_;s'  => '/;\}/',
            );
            $static['with']   = array('', ' ', ' ', '${1}', '}');
            $static['colors'] = '/(?P<context>[:,\h]+#)(?P<hex>[a-z0-9]{6})/i';
        }
        $this->css = preg_replace($static['replace'], $static['with'], $this->css);
        $this->css = preg_replace_callback($static['colors'], array($this, 'selfMaybeCompressCssColorCb'), $this->css);
        $this->css = trim($this->css);

        return $this->css;
    }
726575
private function _style() {
        // we need to compress?
        if($this->compress && $this->_config['compress']['css']) {
            // get cache
            $cache = $this->filename('css');
            if(!$cache)
                return false;

            // get paths
            $web_path = $this->_config['paths']['css'] . '/' . $cache;
            $system_path = $this->css['full'] . DS . $cache;

            // no cache file? write it
            if(!file_exists($system_path)) {
                // process compression
                $output = $this->process('css');

                // write to file
                file_put_contents($system_path, $output);
            }

            // output with the HTML helper
            return $this->Html->css($web_path);

        // no need to compress? output separately with the HTML helper
        } else return $this->Html->css($this->css['extern']);
    }
335298
public function get_css_content_editor() {
        $css = '';
        $cssfiles = $this->editor_css_files();

        // If editor has static CSS, include it.
        foreach ($cssfiles as $file) {
            $css .= file_get_contents($file)."\n";
        }

        // If editor has SCSS, compile and include it.
        if (($convertedscss = $this->editor_scss_to_css())) {
            $css .= $convertedscss;
        }

        $output = $this->post_process($css);

        return $output;
    }
1153621
private function compileCSPRO()
    {
        # Filter out the blacklisted directives
        $filteredConfig = array_diff_key(
            $this->csproConfig,
            array_flip($this->csproBlacklist)
        );

        return self::compile($filteredConfig);
    }
1166022
public function renderCss()
    {
        $cssFileList = $this->getCssFileList();

        if ($cssFileList->count() == 0) {
            return '';
        }

        $generate   = true;
        $bundlePath = $this->getCssBundlePath();

        if (!$this->getForce() && file_exists($bundlePath)) {
            $cacheTime = filemtime($bundlePath);

            if (false !== $cacheTime && $cacheTime >= $cssFileList->getMaxMTime()) {
                $generate = false;
            }
        }

        $bundleUrl = $this->getCssBundleUrl();

        if ($generate) {
            $data   = '';
            $filter = $this->getCssFilter();

            foreach ($cssFileList as $file => $fileInfo) {
                $data .= '/* --------- ' . $file . ' --------- */' . PHP_EOL;
                $contents = @file_get_contents($fileInfo->getPathname());
                if (!$contents) {
                    $data .= '/* FILE READ ERROR! */' . PHP_EOL;
                } else {
                    if (null !== $filter) {
                        $contents = $filter->filterFile($contents, $file, $fileInfo, $bundleUrl, $bundlePath);
                    }

                    $data .= $contents . PHP_EOL;
                }
            }

            if (null !== $filter) {
                $data = $filter->filter($data);
            }

            $cacheTime = $this->writeBundleFile($bundlePath, $data);
        }

        $template = $this->getCssTemplate();

        if (is_callable($template)) {
            return call_user_func($template, $bundleUrl, $cacheTime, $this->getRenderAsXhtml());
        }

        return sprintf(
            $template,
            $bundleUrl,
            $cacheTime,
            $this->getRenderAsXhtml() ? ' /' : ''
        );
    }
1137249
public function getCss()
    {
        switch ($this->type) {
            case self::TYPE_ERROR:
                $css = 'danger';
                break;
            case self::TYPE_WARNING:
                $css = 'warning';
                break;
            case self::TYPE_INFO:
                $css = 'info';
                break;
            case self::TYPE_SUCCESS:
                $css = 'success';
                break;
            default:
                $css = 'info';
                break;
        }

        return $css;
    }