开发者

Where can I find some open source code compressors [closed]

开发者 https://www.devze.com 2023-03-01 05:52 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currentl开发者_JS百科y accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currentl开发者_JS百科y accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 8 years ago.

Improve this question

I'd like to host a JavaScript code compressor on my website and would like to know if there are any open source compressors written in PHP or JavaScript that I can download for free.

Beyond that, I'd also like to know about other code compressors like HTML, CSS and plain text.


These are javascript minifers

http://www.crockford.com/javascript/jsmin.html

http://dean.edwards.name/weblog/2007/04/packer3/

This is online javascript code compressor

http://javascriptcompressor.com/


I use the Yahoo! compressor, I use the .net version but it looks as though there is a php module that someone has published. I haven't used it personally so can't vouch for it.


I use UglifyJS which is not only written in JavaScript but uses NodeJS (a backend JavaScript programming language) to compress your JavaScript files. For me it was a tossup between using Google Closure or Uglify and research showed that Uglify/Node was faster and led to slightly small files. Libraries like jQuery have also moved to Uglify.

Setting up UglifyJS is not that hard. You don't need to know Node to use it (though if you know JavaScript you pretty much know Node already). UglifyJS comes as both a shell utility and a Node js library you can import and use in your Node script. I went ahead and did the later as diving into Node was fun, but you could also write a php script to drop down to shell and use the Node shell utility. You do need to compile Node for your server in either situation, though (which also installs the V8 JavaScript engine).

Once you have Node installs you could do additional fun things like setup jshint to validate your JS on your server.

0

精彩评论

暂无评论...
验证码 换一张
取 消