module Opal::Util

def gzip(source)

Gzip code to check file size.
def gzip(source)
  sh 'gzip -f', data: source
end

def sh(command, data:)

def sh(command, data:)
  out, _err, status = Open3.capture3(command, stdin_data: data)
  raise ExitStatusError, "exited with status #{status.exitstatus}" unless status.success?
  out
end

def uglify(source, mangle: false)

Returns:
  • (String) -

Parameters:
  • str (String) -- string to minify
def uglify(source, mangle: false)
  sh "#{'ruby ' if Gem.win_platform?}bin/yarn -s run terser -c #{'-m' if mangle}", data: source
end