Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is an easy-to-use JavaScript minifier for Ubuntu?

What is an easy-to-use free JavaScript minifier running in Ubuntu?

It should be easy to install as well. ;-)

like image 596
helle Avatar asked Dec 07 '22 01:12

helle


2 Answers

I'm using the YUI Compressor

like image 200
Maurice Perry Avatar answered Dec 28 '22 01:12

Maurice Perry


Check JSMin:

https://bitbucket.org/dcs/jsmin/

Install it with:

sudo apt-get install python-pip
sudo pip install jsmin

Usage as CLI:

python -m jsmin myfile.js

For example:

python -m jsmin large1.css large2.css > minified.css

As library:

from jsmin import jsmin
with open('myfile.js') as js_file:
    minified = jsmin(js_file.read())
like image 39
Havok Avatar answered Dec 28 '22 00:12

Havok