Javascript minifiers

JavaScript minification reduces your JavaScript file size obviously without changing its functionality. Here let’s see several JavaScript minification tools including one command tool and two online ones.

JS minify command tool: JSMin

JSMin is an open-source minification tool that you can download to your local machine and use it as a command line. It allows pass optional parameters so it is convenient to add a copyright message at the beginning.

$ jsmin <fulljslint.js >jslint.js "(c)2002 Douglas Crockford"

It removes comments and unnecessary whitespace and typically reduces filesize by half. It replaces carriage returns ('\r') with linefeeds ('\n').

JS minify online tool: JSCompress (supports uploading multiple files)

JSCompress says it can compress and minify all of your JS files by up to 80% of their original size. You can paste your code or you can upload JavaScript files (Yes, you can upload multiple files and compress to one) then copy or download the output.

It uses UglifyJS 3 and babel-minify for all JavaScript minification and compression.

JS minify online tool: JavaScript Minifier (provides an API)

JavaScript Minifier does not provide uploading and downloading, to use it you just paste code as input and copy the output.

It provides an API that you can use to perform minification in a programming way with many languages. You just need to make a POST request to https://javascript-minifier.com/raw with the input parameter set to the JavaScript you want to minify. Below are examples using wget and curl commands to make the request.

# Use wget
$ wget --post-data="input=`cat main.js`" --output-document=main.min.js https://javascript-minifier.com/raw

# Use curl
$ curl -X POST -s --data-urlencode 'input@main.js' https://javascript-minifier.com/raw > main.min.js

JS minify online tool: Minifier JS Online (offers minification options)

Minifier JS Online does not provide uploading and downloading either.But it offers some options before minifying:

  • Preserve compatibility with IE6-8

  • Display output indented

  • Change names of local variables

  • Reserve words (You can input some words that can be reserved)

It is based on UglifyJS2 project by Mihai Bazon. The input size is limited to 2 MB.

July 21, 2020 dev

A universal document converter -- Pandoc

February 23, 2021

cmd dev

Tools to manage code snippets

2 apps to manage your code snippets in local machine: massCode and SnippetStore. Both tools are open source apps with different features. You can choose one according your needs.

dev

A tool to learn Git

LearnGitBranching is an online tool that provides an visual and interactive way to learn Git. It is a pure clientside application written in JavaScript, only an HTML page with some JS and CSS, there's no AJAX requests. Just open it in a browser and you are ready to use it. It offers various levels for you to challenge. See more on its GitHub repository.

dev git