Sha256: 81112884a6589e3bb87c2b74f659862a36381eecc2e9f213c4c562fc301ee92f
Contents?: true
Size: 787 Bytes
Versions: 16
Compression:
Stored size: 787 Bytes
Contents
# frozen_string_literal: true require 'open3' module Opal module Util extend self ExitStatusError = Class.new(StandardError) # Used for uglifying source to minify. # # Opal::Util.uglify("javascript contents") # # @param str [String] string to minify # @return [String] def uglify(source, mangle: false) sh "#{'ruby ' if Gem.win_platform?}bin/yarn -s run terser -c #{'-m' if mangle}", data: source end # Gzip code to check file size. def gzip(source) sh 'gzip -f', data: source end private 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 end end
Version data entries
16 entries across 16 versions & 1 rubygems