Comments (10)
应该是配置错了,请参照示例配置,https://github.com/laoshu133/grunt-css-sprite/tree/master/test
或者给出详细配置和运行日志
from grunt-css-sprite.
options: {
// 映射CSS中背景路径,支持函数和数组,默认为 null
imagepath_map: null,
// 各图片间间距,如果设置为奇数,会强制+1以保证生成的2x图片为偶数宽高,默认 0
padding: 2,
// 是否使用 image-set 作为2x图片实现,默认不使用
useimageset: false,
// 是否以时间戳为文件名生成新的雪碧图文件,如果启用请注意清理之前生成的文件,默认不生成新文件
newsprite: false,
// 给雪碧图追加时间戳,默认不追加
spritestamp: false,
// 在CSS文件末尾追加时间戳,默认不追加
cssstamp: false,
// 默认使用二叉树最优排列算法
algorithm: 'binary-tree',
// 默认使用pixelsmith
图像处理引擎
engine: 'pixelsmith',
// sprite背景图源文件夹,只有匹配此路径才会处理,默认 images/slice/
imagepath: 'trunk/h5/imgs/',
// 雪碧图输出目录,注意,会覆盖之前文件!默认 images/
spritedest: 'dist/h5/imgs/',
// 替换后的背景路径,默认 ../images/
spritepath: '../../imgs/'
},
files: [{
// 启用动态扩展
expand: true,
// css文件源的文件夹
cwd: 'temp/h5/css/',
// 导出css和sprite的路径地址
dest: 'dist/h5/css/',
// 匹配规则
src: '*.css',
// 导出的css名
ext: ".min.css"
}]
哪里错了?
from grunt-css-sprite.
css里的url(trunk/h5/imgs/aa.png)
from grunt-css-sprite.
imageSetSprite: {
options: {
useimageset: true,
imagepath_map: ['/w/grunt-css-sprite/test/', '../'],
/*
imagepath_map: function(uri) {
return String(uri).replace('/w/grunt-css-sprite/test/', '../');
},
*/
spritedest: 'test/publish/images/imageset/'
},
你那里是这样写的,imagepath_map不是为空吗?输入目录必须是有publish目录吗?
from grunt-css-sprite.
能否发一份demo到我邮箱
from grunt-css-sprite.
我搞定了,改了你的sprite.js和依赖项中的JS
from grunt-css-sprite.
如果css文件中有的引用了png图片,有的引用了svg图片,运行报错:Warning: Unsupported file type: image/svg+xml Used --force, continuing
如果css文件中只引用png图片,可以正常工作。
from grunt-css-sprite.
内置图片引擎不支持 svg,建议使用 png 的图
from grunt-css-sprite.
@laoshu133 对于即使用svg又使用png的项目,是否应用处理前先过滤掉非png格式的图片,然后再处理,这样svg即使不能生成雪碧图,也不应该报错。
from grunt-css-sprite.
如果有需要可以参考 可选依赖 ,使用 Graphics Magick(gm) 进行图片合并
from grunt-css-sprite.
Related Issues (20)
- 請問如何配置才能正確用到background-size去做高清圖雪碧圖 HOT 1
- 时间戳可以考虑交给别的插件做,做精巧的雪碧图零件 HOT 1
- 我怎么安装不成功呢 HOT 1
- 安装老是报这个错误 HOT 1
- 当使用background-size的时候会有BUG HOT 1
- url用绝对路径的写法无法比配 HOT 1
- gulp版本 HOT 2
- Spritesmith 更新到 1.0 版本 HOT 1
- 优化合并 retinae 图像的逻辑 HOT 5
- 望支持图片文件名 HOT 8
- 如何避免不必要的背景图片? HOT 5
- 使用雪碧图自动化工具,是不是要求构建前的图片背景不得设置background-position? HOT 3
- 怎么不支持less HOT 2
- 可否支持指定单位
- 本地无法产出雪碧图 HOT 3
- 生成的雪碧图为32位 HOT 1
- 如果能支持 手机端 根据所使用的rem 自动缩放就完美了
- 输出的css里能否带每张图片的尺寸
- photoshop中选择交错方式保存的png图片,无法正常生成雪碧图
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-css-sprite.