Gulp plugin abraia gulp release

The Abraia Gulp plugin enables an easy task automation of image optimization workflows using Gulp. It integrates the service to perfectly optimize all your JPEG, PNG, GIF, SVG, and WebP images.

Gulp optimization


Install Gulp and the plugin:

npm install gulp gulp-abraia gulp-cache --save-dev

Get your free API key and set the ABRAIA_KEY environment variable every time you start your terminal. (NOTE: On Windows, use set instead of export.)

export ABRAIA_KEY=your_api_key

For a persistent configuration, we recomend following the operating system recomendations. But, if you do not have any security concern, you can easily set the ABRAIA_KEY in your gulpfile.js, before importing gulp-abraia.



To optimize all the images in a folder (images) and stay watching for new files, you just need to add the next code to your gulpfile.js.

const gulp = require('gulp')
const cache = require('gulp-cache')
const abraia = require('gulp-abraia')

gulp.task('optimize', () => {
  return gulp.src('images/*')

gulp.task('watch', () => {'images/*', gulp.series('optimize'))
gulp watch


To generate several image variants to be used in a responsive design, you just need to specify the with and the renaming policies.

gulp.task('variants', () => {
  return gulp.src('images/*')
      { width: 1920, rename: { prefix: '1920/' } },
      { width: 750, rename: { prefix: '750/' }},
      { width: 375, rename: { prefix: '375/' }}