JavaScript Minifier Ruby Example
Check the example on how to use
Ruby
to minify a JavaScript hardcoded string and output to stdout:require "rest_client" response = RestClient.post "https://www.toptal.com/developers/javascript-minifier/api/raw", {:input => "console.log( 1 )"} puts(response)
Install the
rest-client
gem, save the code to a file named minify.rb
and run the following command:ruby minify.rb
Output:
console.log(1)