Sha256: 84139793bffa8c1d2e330e5a529f89e18400f8a24c62d37ab09967c60ee29032
Contents?: true
Size: 723 Bytes
Versions: 4
Compression:
Stored size: 723 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) sh 'bin/yarn -s run terser -c', 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
opal-1.3.2 | lib/opal/util.rb |
opal-1.3.1 | lib/opal/util.rb |
opal-1.3.0 | lib/opal/util.rb |
opal-1.3.0.rc1 | lib/opal/util.rb |