You are here

public function SingleAssetOptimizerBase::addLicense in Advanced CSS/JS Aggregation 8.3

Same name and namespace in other branches
  1. 8.4 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}. */";
  }
}