Same name in other branches
  1. 6.0.x advagg_ext_minify/src/Asset/Minifier.php \Drupal\advagg_ext_minify\Asset\Minifier::execute()
  2. 8.x-3.x advagg_ext_minify/src/Asset/Minifier.php \Drupal\advagg_ext_minify\Asset\Minifier::execute()
  3. 8.x-4.x advagg_ext_minify/src/Asset/Minifier.php \Drupal\advagg_ext_minify\Asset\Minifier::execute()

Run the command line.

Parameters

string $ext: The string css or js.

Return value

string The file containing the minified data.

2 calls to Minifier::execute()
Minifier::css in advagg_ext_minify/src/Asset/Minifier.php
Minify CSS using via command line.
Minifier::js in advagg_ext_minify/src/Asset/Minifier.php
Minify Javascript using via command line.

File

advagg_ext_minify/src/Asset/Minifier.php, line 115

Class

Minifier
Optimizes a asset via external minifiers.

Namespace

Drupal\advagg_ext_minify\Asset

Code

protected function execute($ext) {
    $run = $this->config
        ->get($ext . '_cmd');
    $run = str_replace([
        '{%CWD%}',
        '{%IN%}',
        '{%IN_URL_ENC%}',
        '{%OUT%}',
    ], [
        $this->root,
        $this->in,
        urlencode(file_create_url($this->in)),
        escapeshellarg(realpath($this->out)),
    ], $run);
    // Run command and return the output file.
    shell_exec($run);
    return $this->out;
}