You are here

public function MinifyJsCommands::minifyJsSkip in Minify JS 8

Same name and namespace in other branches
  1. 8.2 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 71

Class

MinifyJsCommands
A Drush commandfile.

Namespace

Drupal\minifyjs\Commands

Code

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

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