Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
module Uglifyrb
# A wrapper around the UglifyJS interface
class Compressor
def initialize(options = {})
end
def compress(source)
f = Tempfile.new("jstemp")
f.write(source)
f.close
compress_node_with_node(f.path)
end
private
def compress_with_node(path)
output = `uglifyjs '#{source}'`
raise output unless output.empty?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment