Is there a good JavaScript minifier? [closed]

2019-01-02 15:23发布

What JavaScript minifier do you recommend?

9条回答
低头抚发
2楼-- · 2019-01-02 15:44

JavaScript Minifier gives a good API you can use programatically:

curl -X POST -s --data-urlencode 'input=$(function() { alert("Hello, World!"); });' http://javascript-minifier.com/raw

Or by uploading a file and redirecting to a new file:

curl -X POST -s --data-urlencode 'input@ready.js' http://javascript-minifier.com/raw > ready.min.js

Hope that helps.

查看更多
牵手、夕阳
3楼-- · 2019-01-02 15:48
旧人旧事旧时光
4楼-- · 2019-01-02 15:51

If you are using PHP you might also want to take a look at minify which can minify and combine JavaScript files. The integration is pretty easy and can be done by defined groups of files or an easy query string. Minified files are also cached to reduce the server load and you can add expire headers through minify.

查看更多
登录 后发表回答