How to minify jquery files?

2020-02-07 01:58发布

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?

7条回答
\"骚年 ilove
2楼-- · 2020-02-07 02:11

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.

查看更多
The star\"
3楼-- · 2020-02-07 02:15

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?

查看更多
家丑人穷心不美
4楼-- · 2020-02-07 02:18

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.

查看更多
我只想做你的唯一
5楼-- · 2020-02-07 02:23

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

查看更多
来,给爷笑一个
6楼-- · 2020-02-07 02:25

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.

查看更多
狗以群分
7楼-- · 2020-02-07 02:25

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

查看更多
登录 后发表回答