Skip to content

auto merge pngs to an sprite image and auto replace csses's background refrence

Notifications You must be signed in to change notification settings

rwson/png-merger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

png-merger

自动将项目中的零散png合并成雪碧图并修改css中的引用

测试

git clone https://github.com/rwson/png-merger.git

cd path/to/png-merger

npm install

npm test

使用

npm install png-merger -g

# 用法①
#Teiminal切到项目根目录下

#初始化雪碧图配置文件
png-merger init

#合并符合条件的png
png-merger

# 用法②

#Teiminal切到项目根目录下

#把配置项当成命令行参数传递
png-merger i=test/images i=test/imgs c=test l=0.7 s=200x200

参数说明

参数 简写 意义
images i 图片目录, 支持多个
csses c 样式文件目录, 支持多个
level l 优化级别, 0 ~ 1
size s 图片尺寸小于等于width * height时, 才会被合并

可能存在的问题

由于没有用node-canvas之类的模块,所以png-merger依赖了puppeteer, 安装puppeteer时, 可能会下载Chromium, 所以需要提前设置下PUPPETEER_DOWNLOAD_HOST

export PUPPETEER_DOWNLOAD_HOST=https://storage.googleapis.com.cnpmjs.org

npm install png-merger -g	

About

auto merge pngs to an sprite image and auto replace csses's background refrence

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published