Returns css codes

@param string $cssContent
@param array $optionalFlags
@return string
512471
protected function setCssContent($cssContent, $optionalFlags = null)
    {
        $attr = [];
        if (is_null($optionalFlags)) {
            $attr['media'] = 'all';
        } else {
            $knownAttributes = ['media'];
            foreach ($knownAttributes as $value) {
                if (array_key_exists($value, $optionalFlags)) {
                    $attr[$value] = $optionalFlags[$value];
                }
            }
        }
        return '<style type="text/css" media="' . $attr['media'] . '">'
            . $cssContent . '</style>';
    }
1066849
private function getStylesheetsMaxAge()
    {
        if (is_null($this->cssPath)) {
            $this->findPaths();
            $this->checkPaths();
        }
        return $this->getFilesMaxAge($this->cssPath, array('*.css'));
    }
292723
public function parseStylesheet($stylesheet)
    {
        $parsed = array();
        $stylesheet = $this->_stripStylesheet($stylesheet);
        $stylesheet = trim(trim($stylesheet), "}");
        foreach(explode("}", $stylesheet) as $rule) {
            //Don't parse empty rules
        	if(!trim($rule))continue;
        	list($selector, $style) = explode("{", $rule, 2);
            foreach (explode(',', $selector) as $sel) {
                $parsed[] = array(trim($sel), trim(trim($style), ";"));
            }
        }

        return $parsed;
    }
591942
public function renderLegacyCss()
    {
        $cssFiles = [];
        $cssCodeLines = [];

        foreach ($this->legacyHelper->get('css_files', []) as $cssItem) {
            // List of items can contain empty elements, path to files or code
            if (!empty($cssItem)) {
                if (isset($cssItem[5]) && $this->isFile($cssItem, '.css')) {
                    $cssFiles[] = $cssItem;
                } else {
                    $cssCodeLines[] = $cssItem;
                }
            }
        }

        return $this->environment->render(
            $this->cssTemplate,
            [
                'css_files' => $cssFiles,
                'css_code_lines' => $cssCodeLines,
            ]
        );
    }
1140491
public function getCssCode()
    {
        $html = '';
        foreach ($this->css as $css) {
            $html .= sprintf('<link rel="stylesheet" href="%s"/>', $css);
        }
        return $html;
    }
1015247
function getStylingNodes (selector) {
    if (typeof queryCache[selector] === 'undefined') {
      queryCache[selector] = Array.prototype.map.call(
        document.querySelectorAll(selector),
        function (stylesheet) {
          return stylesheet.outerHTML;
        }
      ).join('');
    }

    return queryCache[selector];
  }
988908
private function getCss($cssFiles = array())
    {
        $css = '';
        foreach ($cssFiles as $file) {
            if (file_exists($file)) {
                $css .= file_get_contents($file) . "\n";
            }
        }
        return $css;
    }
1241075
public function getCssBundlePath()
    {
        $cacheDir = $this->getCssCachePath();

        if ($this->isRelativePath($cacheDir)) {
            $cacheDir = $this->getDocRoot() . DIRECTORY_SEPARATOR . $cacheDir;
        }

        $name = $this->getName();

        if (null === $name) {
            $name = sprintf('bundle_%s', $this->getCssFileList()->getHash());
        } elseif (strpos($name, '%s') !== false) {
            $name = sprintf($name, $this->getCssFileList()->getHash());
        }

        return sprintf(
            "%s%s%s.css",
            $cacheDir,
            DIRECTORY_SEPARATOR,
            $name
        );
    }
503219
protected function handleCssImports($css)
    {
        if ($this->options['bubbleCssImports']) {
            // bubble CSS imports
            preg_match_all('/@import.*?;/', $css, $imports);
            $css = implode('', $imports[0]) . preg_replace('/@import.*?;/', '', $css);

            return $css;
        }

        if ('' === $this->options['importWarning']) {
            return $css;
        }

        // remove comments so we don't mistake { in a comment as a block
        $noCommentCss = preg_replace('@/\\*[\\s\\S]*?\\*/@', '', $css);
        $lastImportPos = strrpos($noCommentCss, '@import');
        $firstBlockPos = strpos($noCommentCss, '{');
        if (false !== $lastImportPos
            && false !== $firstBlockPos
            && $firstBlockPos < $lastImportPos
        ) {
            // { appears before @import : prepend warning
            $css = $this->options['importWarning'] . $css;
        }

        return $css;
    }
744598
public function getCustomCSSPrefix()
    {
        if ($parent = $this->getParent()) {
            return sprintf('%s %s', $parent->CSSID, $this->CSSID);
        }
        
        return $this->CSSID;
    }
271680
protected function getCssContent()
    {
        $styleString = "";

        if (class_exists("\\DOMDocument")) {
            $doc = new \DOMDocument();
            $doc->loadHTML($this->getHtmlContent());

            // Extract styles from the HTML file
            foreach($doc->getElementsByTagName('style') as $styleNode) {
                $styleString .= $styleNode->nodeValue . "\r\n";
            }
        } else {
            throw new \RuntimeException("Required extension 'dom' seems to be missing.");
        }

        return $styleString;
    }
996342
public static function cssToArray($css){
        if(!$css) {
            return array();
        }
        $css = str_replace(' /* Do not edit */', '', $css);
        $oldCssArr = explode("\n", $css);
        $newCssArr = array();
        foreach($oldCssArr as $line) {
            if(false === strpos($line, '{')) {
                continue;
            }

            preg_match('~(?P<selector>[^{]+)(\{)(?P<rules>[^}]+)\}~', $line, $matches);

            foreach($matches as $key => &$match){
                if(is_numeric($key)) {
                    continue;
                }
                $match = trim($match);
                if($key === 'rules') {
                    $ruleSet = array_filter(array_map('trim', explode(';', $match)));
                    $match = array();
                    foreach($ruleSet as $rule) {
                        $rule = array_map('trim', explode(':', $rule));
                        $match[$rule[0]] = $rule[1];
                    }
                }
            }

            $newCssArr[$matches['selector']] = $matches['rules'];
        }
        return $newCssArr;
    }
1318052
function CssFlagsClass() {
      var _this;

      var ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
      var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      var cssFlagsPrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'flags';

      _classCallCheck(this, CssFlagsClass);

      _this = _possibleConstructorReturn(this, _getPrototypeOf(CssFlagsClass).call(this, ua));
      _this._flags = flags;
      _this._cssFlagsPrefix = cssFlagsPrefix;
      return _this;
    }
1020525
public function cssBlock($css, array $options = [])
    {
        $options = optionsParser($options, ['block' => true]);

        $out = $this->formatTemplate('style', [
            'attrs' => $this->templater()->formatAttributes($options->toArray(), ['block']),
            'content' => $css,
        ]);

        if (!$options->get('block')) {
            return $out;
        }

        if ($options->contains('block', true)) {
            $options->add('block', 'css');
        }

        $this->_View->append($options->get('block'), $out);
    }
103588
protected function setCssContent($cssContent)
    {
        if (is_string($cssContent)) {
            $this->content = $cssContent;
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($cssContent). "' for argument 'cssContent' given."
            );
        }

        return $this;
    }
408265
function bundleCSS() {
    const glob      = require('glob');
    const srcmap    = require('./srcmap');
    const BUILT_PATH = path.join(__dirname, '..', config.dir.built);

    glob.sync('**/*.css', {
        cwd: BUILT_PATH
    }).forEach((file) => {
        const src = fs.readFileSync(path.join(BUILT_PATH, file)).toString()
            .replace(/^\ufeff/gm, '')
            .replace(/\r\n/gm, '\n')
        ;
        const node = srcmap.getNodeFromCode(src);
        node.prepend(banner('.css', path.basename(file, '.css')));
        const bundleSrc = '\ufeff' + srcmap.getCodeFromNode(node, (srcPath) => {
            const regex_src = new RegExp(`${config.dir.src}\\/${config.dir.stylesheet}\\/`);
            return srcPath
                .replace(/\.\.\//g, '')
                .replace(regex_src, SOURCE_MAP_NAMESPACE)
            ;
        }, { multiline: true });
        fs.writeFileSync(path.join(BUILT_PATH, file), bundleSrc);
        fs.writeFileSync(path.join(DST_PATH, file), bundleSrc);
    });
}
891191
public function css(array $assets, array $options): string
    {
        $contents = [];
        $public = '';

        foreach ($assets as $asset) {
            if ($this->isExternalUrl($asset)) {
                // External url
                $contents[] = sprintf('<link rel="stylesheet" type="text/css" href="%s" media="all" />', $asset);
                continue;
            }
            $content = $this->getCssContent($asset, $options['minify']);

            if (!empty($options['inline'])) {
                $contents[] = sprintf('<style>%s</style>', $content);
            } else {
                $public .= $content . '';
            }
        }

        if (strlen($public) > 0) {
            $name = $options['name'] ?? 'file.css';
            if (empty(pathinfo($name, PATHINFO_EXTENSION))) {
                $name .= '.css';
            }
            $url = $this->publicCache->createCacheBustedUrl($name, $public);
            $contents[] = sprintf('<link rel="stylesheet" type="text/css" href="%s" media="all" />', $url);
        }

        return implode("\n", $contents);
    }