Skip to content

Instantly share code, notes, and snippets.

@guilleiguaran
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guilleiguaran/0b99d991b01bf4f78856 to your computer and use it in GitHub Desktop.
Save guilleiguaran/0b99d991b01bf4f78856 to your computer and use it in GitHub Desktop.
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