gulp自动化管理精灵图 发表于 2016-11-18 | 更新于 2023-01-11 安装 npm install gulp –save-devnpm install gulp.spritesmith –save-dev 1234567891011121314var gulp = require('gulp');var spritesmith = require('gulp.spritesmith');gulp.task('autoSprite', function () { gulp.src('./src/img/*.png').pipe(spritesmith({ imgName: 'sprite.png', cssName: 'sprite.css', padding: 20 })).pipe(gulp.dest('./dist/img/'));});gulp.task('default',['autoSprite'],function(){ console.log('运行成功')})