开发者

I am using the HTML5 Boilerplate and would like to combine multiple jQuery plugins in to one file: how can this be done?

I am using the HTML5 Boilerplate and would like to combine multiple jQuery plugins in to one file. If you could give me a code snippet to study I would greatly appreciate it.

I know this question has been pushed but on one ever show you how it is done.

Dose the YUI compressor that is used with the Yslow firebug plug-in a compressor for JQuery as well: dose it combine all JQuery plug开发者_JAVA百科-ins on a site and out put one nice .js file?


The build script has you covered. It concatenates and minifies all of the files in js/mylibs when you run it.

See more in the HTML5Boilerplate docs


I don't know if the YUI compressor does it by itself, but to compress all of my scripts as well as put them in a file, I use something similar to this in a shell script:

#!/bin/bash
cat jquery.js jquery.plugin1.js jquery.plugin2.js > all.js
# I prefer the closure compiler over YUI compressor.
closure-compiler --compilation_level SIMPLE_OPTIMIZATIONS --js all.js --js_output_file all.min.js


You have to combine the jQuery plugins manually into a single file, just copy and paste them one after the other.

You can use the Build Script that comes with HTML5 Boilerplate to minify the files further. Let me know if you need help doing this.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜