Same name in other branches
  1. 6.0.x src/Asset/SingleAssetOptimizerBase.php \Drupal\advagg\Asset\SingleAssetOptimizerBase::addLicense()
  2. 8.x-3.x src/Asset/SingleAssetOptimizerBase.php \Drupal\advagg\Asset\SingleAssetOptimizerBase::addLicense()
  3. 8.x-4.x src/Asset/SingleAssetOptimizerBase.php \Drupal\advagg\Asset\SingleAssetOptimizerBase::addLicense()

If configured, add licence string to top/bottom of file.

Parameters

string $contents: The file contents.

string $path: The original file path.

1 call to SingleAssetOptimizerBase::addLicense()
CssMinifier::loadFile in advagg_css_minify/src/Asset/CssMinifier.php
Loads the stylesheet and resolves all @import commands.

File

src/Asset/SingleAssetOptimizerBase.php, line 59

Class

SingleAssetOptimizerBase
A base class for optimizing (especially minifying) assets.

Namespace

Drupal\advagg\Asset

Code

public function addLicense(&$contents, $path) {
    if ($this->config
        ->get('add_license')) {
        $url = file_create_url($path);
        $contents = "/* Source and licensing information for the line(s) below can be found at {$url}. */\n" . $contents . "\n/* Source and licensing information for the above line(s) can be found at {$url}. */";
    }
}