15 Star 42 Fork 8

AresYe / gulp-css-gmspriter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

#gulp-css-gmspriter

简单的移动端css切片图合成工具

#依赖的工具库: nodejs

GraphicsMagick 下载地址:http://www.graphicsmagick.org/

python 下载地址:https://www.python.org/

#可选的工具库 compass+ruby+sass

#主要实现的功能

1.将原型图片进行处理,需要合成的图片目录images/icons/,输出到images/slice/目录下

images/icons/目录存放2x原型图片
输入图片说明

images/slice/目录生成1x,2x图片
输入图片说明 输入图片说明 2.使用gm工具进行图片缩放

3.使用gulp+gulp-css-spritersmith插件 进行css代码片段的图片合成

4.输出目录publish/

#优势 1.不需要更改原来的css文件代码

2.可以配置需要合成的图片源路径,比如:images/icons

3.自动添加media query 移动设备查询代码片段,适应不同的屏幕材质(比如retina)

#缺点 1.需要手动输入源切片图的css代码:

.m-icon-fail{
 background: url(#{$icon_1_path}/m-pay-err.png) no-repeat;
 width:100px;
 height:100px;
}


.m-icon-success{
 background: url(#{$icon_1_path}/m-suc.png) no-repeat;
 width:28px;
 height:28px;
}



#合成后的代码

.m-icon-fail { background: no-repeat;background-position: 0 0; width: 100px; height: 100px; }

.m-icon-success { background: no-repeat;background-position: 0 -183px; width: 28px; height: 28px; }

#示例 下载zip后,执行npm install,再执行gulp 如果没有compass环境,请将gulpfile.js中的compass的配置做相应调整,改成css监听

The MIT License (MIT) Copyright (c) 2016 area Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

移动端css切片图合成雪碧图工具 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/area/gulp-css-gmspriter.git
git@gitee.com:area/gulp-css-gmspriter.git
area
gulp-css-gmspriter
gulp-css-gmspriter
master

搜索帮助