Skip to content

Instantly share code, notes, and snippets.

@david-j-davis
Created April 17, 2017 22:40
Show Gist options
  • Save david-j-davis/3eae8284cc667dd37e56c78c41cf7604 to your computer and use it in GitHub Desktop.
Save david-j-davis/3eae8284cc667dd37e56c78c41cf7604 to your computer and use it in GitHub Desktop.
Takes retina images and downsizes them inside to non-retina images in the same folder using gulp-retinize
var retinize = require('gulp-retinize');
gulp.task('retiniizing', function(file) {
/* NOTE: Retinize accepts @4x and @2x resolutions, outputting to @4x, @2x, and @1x.
Overrides may be implemented by manually creating lower resolution copies in the source directory. */
const retinizeOpts = {
// Your options here.
};
console.log('Retinizing images...');
return gulp.src(file && file.path || './path/to/your/sprites/*.{png,jpg,jpeg}')
.pipe(retinize(retinizeOpts))
.on('error', function(e) {
console.log(e.message);
})
.pipe(gulp.dest('./path/to/your/sprites/'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment