You are here

public function MinifyJs::minify in Minify JS 8.2

Minify a single file.

Parameters

object $file: The file to minify.

File

src/MinifyJs.php, line 71

Class

MinifyJs
Minify JS Service.

Namespace

Drupal\minifyjs

Code

public function minify($file) {
  $result = $this
    ->minifyFile($file, TRUE);
  if ($result === TRUE) {
    \Drupal::messenger()
      ->addMessage(t('File was minified successfully.'));
  }
  else {
    \Drupal::messenger()
      ->addMessage($result, 'error');
  }
}