用rambo将你的图片嵌入css精灵
rambo的Python项目详细描述
命令行精灵工具,用于将图像粉碎为精灵。
包括Joe Wezorek写的pypacker。
功能
- 自动支持多个精灵分辨率(基于文件夹名称)
- pngcrush低脂肪饮食
- 生成HTML测试页,以便预览精灵
- Python,所以它燃烧得很快
设置图像
对于每个像素纵横比,您需要将精灵图像放到子文件夹中。
Eg, sprites/ foo/ (the 1x has no prefix. Your sprite will be called this.) foo-0.75x/ (smaller than 1x for poxy androids. Use the same base-name `foo`) foo-1.5x/ (android pseudo-retina) foo-2x/ (true retina) bar/ bar-2x/
用法
pip install rambo
然后从命令行运行rambo:
rambo --input "images/sprites" --output "images" --csspath "css" --cssfile "_sprites.scss" --sasspath "sass/sprites" --testpage_dir "site" --testpage_name "test_page.html"
参数
-h, --help show this help message and exit --input INPUT Input directory, images/sprites --output OUTPUT Output directory, images/ --cssfile CSSFILE CSS filename, _sprites.scss --csspath CSSPATH CSS output path, css --sasspath SASSPATH SaSS output path, sass/sprites --testpage_dir TEST_DIR Cheat sheet dir, site/ --testpage_name TESTPAGE Cheat sheet, cheat_sheet.html