This site has been acquired by
(Attention! API endpoint has changed)

JavaScript Minifier

Online JavaScript Minifier/Compressor. Provides an API. Simple and Fast.


Thanks to Boris Kotyrev (I've adapted what he sent to be more minimal).

use strict;
use warnings;

use File::Slurp;
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;

sub minify{
    my ($js) = @_;

    my $js_min_url = "";

    my $ua = LWP::UserAgent->new;
    my $request = POST($js_min_url, [ 'input' => $js ]);
    my $js_min = $ua->request($request)->decoded_content();

    return $js_min;

print minify($js, "\n");

Click on the language of your choice to see an example: