最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to minify jquery files? - Stack Overflow

programmeradmin1浏览0评论

I am using jquery and I got a couple plugins that don't offer a minified version. So I want to take the full version and minfiy it but all the sites I have found that you input your javascript and it minifies it breaks the plugin.

Like it must strip something out because I get a syntax error.

So anyone got a good one that I can use?

I am using jquery and I got a couple plugins that don't offer a minified version. So I want to take the full version and minfiy it but all the sites I have found that you input your javascript and it minifies it breaks the plugin.

Like it must strip something out because I get a syntax error.

So anyone got a good one that I can use?

Share Improve this question asked Nov 5, 2009 at 5:11 chobo2chobo2 85.8k207 gold badges549 silver badges861 bronze badges 1
  • although you've chosen a different answer here, just wanted to point out that I've used the Javascript Compressor Rater on jQuery itself (had to create my "own" version of it) and it worked perfectly. FYI – TheCuBeMan Commented Sep 6, 2015 at 11:03
Add a comment  | 

7 Answers 7

Reset to default 5

If you're familiar with Java you could also use YUI compressor to minify JS (and CSS) files yourself. We use it here as well and it works great.

Javascript Compressor Rater

I believe it runs the js through rhino and outputs any errors found before hand, and after you can choose the one that works best for you.

It could be because one or more files don't have a trailing semi-colon, which is usually fine but I think causes problem on minification. Alternatively you may have issues with regex literals. What minifier are you using?

If you are minfying the plugins as separate files, the process may be renaming a symbol that is part of the jQuery API, because the minifier is not aware of the interaction.

ASP.net team published a free tool that enables you to improve the performance of your Ajax applications by reducing the size of its JavaScript files. The new tool is named the Microsoft Ajax Minifier. Deatails here: Deatails about Ajax Minifier

Download it here Download link

If you have PHP5 and Zlib on your server, then try this one! http://code.google.com/p/minify/

I use it to combine jQ, jQ Plug-ins, jQ-UI, and custom site application client-code into a single file.

I then load that JS file and a small page-specific JS file (with onload, etc) onto each page. It works well...and it also handles CSS.

I don't leave home without it. (that's just a saying :)

It's likely to be a semicolon issue. I find Microsoft's AjaxMin is a pretty reasonable tool that's easy to customise.

You might like to check out PackScript - http://danderson00.blogspot.com.au/2013/01/packscript-next-generation-build-for-web.html

发布评论

评论列表(0)

  1. 暂无评论