You are here

public function MinifyJsCommands::minifyJsSkip in Minify JS 8.2

Same name and namespace in other branches
  1. 8 src/Commands/MinifyJsCommands.php \Drupal\minifyjs\Commands\MinifyJsCommands::minifyJsSkip()

Minify all JS files that are not currently minified.

@usage drush minify-js-skip Js files minification.

@command minify-js-skip @aliases minifyjslite

File

src/Commands/MinifyJsCommands.php, line 84

Class

MinifyJsCommands
A Drush commandfile.

Namespace

Drupal\minifyjs\Commands

Code

public function minifyJsSkip() {
  $this
    ->output()
    ->writeln('Minifying all JS files not currently minified...');
  $files = $this->minifyJs
    ->loadAllFiles();
  foreach ($files as $fid => $file) {
    if (!empty($file->minified_uri)) {
      $status = $this->minifyJs
        ->minifyFile($fid);

      // Only output error messages.
      if ($status !== TRUE) {
        $this
          ->output()
          ->writeln($status);
      }
    }
  }
  $this->cache
    ->delete(MINIFYJS_CACHE_CID);
  $this
    ->output()
    ->writeln('Complete!');
}