Same name in other branches
  1. 5.0.x advagg_css_minify/src/Asset/CssMinifier.php \Drupal\advagg_css_minify\Asset\CssMinifier::loadFile()
  2. 6.0.x advagg_css_minify/src/Asset/CssMinifier.php \Drupal\advagg_css_minify\Asset\CssMinifier::loadFile()
  3. 8.x-3.x advagg_css_minify/src/Asset/CssMinifier.php \Drupal\advagg_css_minify\Asset\CssMinifier::loadFile()

Loads the stylesheet and resolves all @import commands.

Loads a stylesheet and replaces @import commands with the contents of the imported file. Use this instead of file_get_contents when processing stylesheets.

The returned contents are compressed removing white space and comments only when CSS aggregation is enabled. This optimization will not apply for color.module enabled themes with CSS aggregation turned off.

Note: the only reason this method is public is so color.module can call it; it is not on the AssetOptimizerInterface, so future refactorings can make it protected.

Paramètres

string $file: Name of the stylesheet to be processed.

Return value

string Contents of the stylesheet, including any resolved @import commands.

1 call to CssMinifier::loadFile()
CssMinifier::loadNestedFile dans advagg_css_minify/src/Asset/CssMinifier.php
Loads stylesheets recursively and returns contents with corrected paths.

Fichier

advagg_css_minify/src/Asset/CssMinifier.php, line 227

Classe

CssMinifier
Optimizes a JavaScript asset.

Namespace

Drupal\advagg_css_minify\Asset

Code

public function loadFile($file) {
    $content = '';
    if ($contents = @file_get_contents($file)) {
        $contents = $this->clean($contents, []);
        $content = $this->optimize($contents, [
            'data' => $file,
        ], []);
        $this->addLicense($contents, $file);
    }
    return $content;
}