使用yui的压缩工具压缩JS和CSS
http://developer.yahoo.com/yui/compressor/
yuicompressor.jar这个文件要和ymin这个文件放在一个目录下。
ymin的代码如下
#!/bin/sh
#filename=ymin
basedir=$(dirname $0)
jsmin="java -jar $basedir/yuicompressor.jar --type js"
cssmin="java -jar $basedir/yuicompressor.jar --type css"
for f in $*; do
case $f in
*.source.js)
n=`echo $f | sed s/.source.js$//`
$jsmin $f -o $n.js ;;
*.js)
n=`echo $f | sed s/.js$//`
$jsmin $f -o $n-min.js ;;
*.source.css)
n=`echo $f | sed s/.source.css$//`
$cmd;$cssmin $f -o $n.css ;;
*.css)
n=`echo $f | sed s/.css$//`
$cssmin $f -o $n-min.css ;;
*)
find $f -exec ymin {} ';';;
esac
done
使用示例
ymin a.js
#生成 a-min.js
ymin a.source.js
#生成 a.js
ymin *.js
#依上两个规则批量处理find *.js查找到文件
压缩CSS就 不举例了
使用javascript lint检查js文件
http://www.javascriptlint.com/
mac用户可使用brew install jsl安装
#!/bin/sh
#filename=jslt
option="-nologo"
for f in $*; do
case $f in
*.js)
jsl $option -process $f;;
-*)
option="$option $f";;
*)
find $f -exec jsl $option {} ';';;
esac
done
使用示例
jslt a.js
jslt *.js
jslt -nocontext *.js
使用PNGOUT压缩文件
http://advsys.net/ken/utils.htm
这个只列下帮助吧,我没有用SHELL再包了
$ pngout --help
Warning: unrecognized option: --help
Must specify a source or target image
PNGOUT [In:{PNG,JPG,GIF,TGA,PCX,BMP}] (Out:PNG) (options...) Jul 22 2011
by Ken Silverman (http://advsys.net/ken)
Mac port assistance by Jonathon Fowler (http://www.jonof.id.au/pngout)
PNGOUT optimizes PNG size losslessly using my own deflate algorithm (not Zlib)
With the right options, it can often beat other programs by 5-10%. Options:
-c# PNG output color: 0=Gray, 2=RGB, 3=Pal, 4=Gray+Alpha, 6=RGB+Alpha
-f# PNG output filter: 0=none, 1=x, 2=y, 3=x&y, 4=Paeth, 5=mixed, 6=reuse
-d# Override default bitdepth: 0(min),1,2,4,8 (valid only in /c0,/c3 modes)
-s# Select strategy. 0:Xtreme(default), 1:Intense, 2:Longest Match,
3:Huffman Only, 4:Uncompressed
-b# Block split threshold (lower=more blocks, 0=1 block/file, default=256)
Use trial&error! Suggested values to try are: 0,128,192,256,512,1024,..
-n# Exact number of Huffman blocks (overrides /b#)
-r Randomized initial tables (good for many trials with same options)
-k? 0=Remove optional chunks (default), 1=Keep all
p=Keep palette indices, s=Keep settings for /c,f,d,b
-k(Chunk,Chunk,..) Preserve only named chunk(s). Example: -kgAMA,bKGD,tEXt
-v,q,l Verbose,Quiet,List mode (use '-' as filename to specify stdin/stdout)
-y Assume Yes at the 'overwrite file?' prompt
-force Write file even if bigger.
-mincodes# Workaround for buggy decoders. 1:Zlib 1.2.1 bug, 2:buggy mobiles
The 1st filename is the input. If you omit the output
filename, PNGOUT will use the same filename with a .PNG extension. Examples:
$ pngout inlarge.bmp outsmall.png <- writes outsmall.png
$ pngout duke3d.png -c2 -f3 -b128 -kbKGD -v <- writes duke3d.png if smaller
分享到:
相关推荐
- 注意3:app.js 内定义了主模块名:starter (`angular.module('starter'`),构建时编译templates目录下的模板文件时,硬编码使用 starter 模块名,如果需要更改app.js内的主模块名,则需要对应到构建描述文件gulp...
本项目基于Java开发,包含2071个文件,包括JavaScript脚本、SVG图形、CSS样式表、Java源代码、TypeScript脚本、HTML页面、JPG图片、MAP映射文件、WOFF2字体文件、PNG图片。系统实现了基于Java的Linux运维监控工具...
grunt-contrib-compass(使用Compass将Sass编译为CSS) grunt-contrib-imagemin(缩小PNG,JPEG和GIF图像) 凉亭组件: bower.json 引导程序 jQuery的 角砌 角接触 快速点击 指令: app/js/directives.js ...
gulp opti_img-图形优化gulp字体-转换字体:.ttf => .woff + .woff2特征js库存储在src /脚本/ CSS库存储在src / css /中精灵的svg存储在resource / svg / .ttf文件存储在resource / fonts / 样式表,js代码,html-...
使用读取图像的大小并用该大小替换 CSS 中的指令。 受和启发。 用法 var rework = require ( 'rework' ) ; var sass_images = require ( 'rework-sass-images' ) ; var css = rework ( str ) . use ( sass_images...
pagination.css 分页效果css(直接用ff扣下来的。HOHO) jquery-1.3.2.min.js jq的load方法我喜欢。类似ajax的效果 onOver.png 鼠标移上去时候的效果 jar包就是strut2的基本的那几个就可以了,当然freemarker...
gzip_min_length 5k;...gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;gzip_vary on; 配置指令详细注释:g
可视化SSH工具 - 基于TypeScript开发,包含76个文件,如TS、PNG、JSON、CSS、GITIGNORE、LICENSE、MD、JS、WOFF2和HTML等。该项目为用户提供了一个易于使用和操作的SSH工具,通过图形化界面,将复杂的SSH指令转换为...
React Jest测试yeoman生成器那是什么 ?...npm install -g yonpm install -g generator-react-jest-tests指令假设您具有以下文件结构- app/- components/ - MyComp.js - MaybeSome.css - AndA.png- storesOrUtil
该文件夹将包含所有需要使用该扩展程序开始的文件夹和文件。 开发指令 您可以运行以下命令: 命令 描述 毛线生成 建立网站。 纱去 在启动本地服务器。 结构体 将生成,压缩和下载以下文件夹结构: myAddon ├...