after_prepare/uglify.js
function compress(file) {
  var ext = path.extname(file),
    res,
    source,
    result;

  switch (ext) {
    case '.js':
      console.log('uglifying js file ' + file);

      res = ngAnnotate(String(fs.readFileSync(file, 'utf8')), {
        add: true
      });
      result = UglifyJS.minify(res.src, hookConfig.uglifyJsOptions);
      fs.writeFileSync(file, result.code, 'utf8'); // overwrite the original unminified file
      break;

    case '.css':
      console.log('minifying css file ' + file);

      source = fs.readFileSync(file, 'utf8');
      result = cssMinifier.minify(source);
      fs.writeFileSync(file, result.styles, 'utf8'); // overwrite the original unminified file
      break;

    default:
      console.log('encountered a ' + ext + ' file, not compressing it');
      break;
  }
}
function compress(file) {
  var ext = path.extname(file),
    res,
    source,
    result;

  switch (ext) {
    case '.js':
      console.log('uglifying js file ' + file);

      res = ngAnnotate(String(fs.readFileSync(file, 'utf8')), {
        add: true
      });
      result = UglifyJS.minify(res.src, hookConfig.uglifyJsOptions);
      fs.writeFileSync(file, result.code, 'utf8'); // overwrite the original unminified file
      break;

    case '.css':
      console.log('minifying css file ' + file);

      source = fs.readFileSync(file, 'utf8');
      result = cssMinifier.minify(source);
      fs.writeFileSync(file, result.styles, 'utf8'); // overwrite the original unminified file
      break;

    default:
      console.log('encountered a ' + ext + ' file, not compressing it');
      break;
  }
}
function compress ( file ) { var ext = path . extname ( file ) , res , source , result ; switch ( ext ) { case '.js' : console . log ( 'uglifying js file ' + file ) ; res = ngAnnotate ( String ( fs . readFileSync ( file , 'utf8' ) ) , { add : true } ) ; result = UglifyJS . minify ( res . src , hookConfig . uglifyJsOptions ) ; fs . writeFileSync ( file , result . code , 'utf8' ) ; // overwrite the original unminified file break ; case '.css' : console . log ( 'minifying css file ' + file ) ; source = fs . readFileSync ( file , 'utf8' ) ; result = cssMinifier . minify ( source ) ; fs . writeFileSync ( file , result . styles , 'utf8' ) ; // overwrite the original unminified file break ; default : console . log ( 'encountered a ' + ext + ' file, not compressing it' ) ; break ; } }
Compresses file.
@param  {string} file - File path
@return {undefined}
Compresses file .