Giter Site home page Giter Site logo

gulp-imageoptim's People

Contributors

allbitsnbytes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gulp-imageoptim's Issues

Optional support for JPEGmini

Hi!
I really love your tool and it works really well, but if possible, I'd also like optional support for JPEGmini as that's the one feature I feel missing.

Are there any plans on integrating that?

ImageAlpha

Should ImageAlpha be used alongside ImageOptim?

Ive ran a test gulp task and manual process on the same images and i get a better result from the manual process (ImageAlpha > ImageOptim). This makes me think ImageAlpha isn't running in the gulp task.

Lossy Option?

Is there an option to set lossy vs lossless, and set the target quality?

Optimize image simultaneously

How do I optimize images simultaneously?
Right now they optimizing one by one which takes very long time.

I run the following task from my gulpfile.js:

// `gulp imageoptim` - Run lossless compression on all the images.
gulp.task('imageoptim', function() {
  return gulp.src(globs.images)
    .pipe(imageOptim.optimize())
    .pipe(gulp.dest(path.dist + 'images'))
    .pipe(browserSync.stream());
});

Stream Support?

Handing over a resized imaged to imageOptim (in the same stream) don't seem to work (example below works fine with imagemin). Any suggestions how to resolve this? Or should I look into task dependency?

gulp.task('images', function() {
  return gulp.src('src/images/**/*')
    .pipe(imageResize({
      width: "50%"
    }))
    .pipe(imageOptim.optimize())
    .pipe(gulp.dest('build/images'));
});

Fails when file has brackets

Hey,

It seems that the script fails to work when the image in question has brackets in the name. Here's the log:

Error: Command failed: /bin/sh -c find /Applications/MAMP/htdocs/frontend-framework/assets/dist/img/imgOptim-Screen Shot 2015-05-27 at 14.22.38 (2).png | sh ./node_modules/gulp-imageoptim/node_modules/.bin/imageOptim -a -c -q | grep TOTAL
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `find /Applications/MAMP/htdocs/frontend-framework/assets/dist/img/imgOptim-Screen Shot 2015-05-27 at 14.22.38 (2).png | sh ./node_modules/gulp-imageoptim/node_modules/.bin/imageOptim -a -c -q | grep TOTAL '

As soon as I took out the brackets it worked. While I appreciate that you shouldn't have brackets or spaces (etc) in your file names, it could still do with being fixed?

TypeError: Data must be a string or a buffer

I have setup to use imageOptim in my gulp project.
Each time I run this I am getting the following errors;

crypto.js:67
  this._handle.update(data, encoding);
               ^

TypeError: Data must be a string or a buffer
    at TypeError (native)
    at Hash.update (crypto.js:67:16)
    ....

Any ideas on what is causing this or how to resolve it?

Console clutter when passing no images

Hi there! Thanks for the extremely useful plugin.

My issue is that when no images are passed through to this plugin (for example, filtering via newer after a delete event), I get a console error:

{ Error: Command failed: bash node_modules/gulp-imageoptim/scripts/optimize.bash 06962c9b44b38b68736f1c7e7d8d2b81 

    at ChildProcess.exithandler (child_process.js:205:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:194:7)
    at maybeClose (internal/child_process.js:899:16)
    at Socket.<anonymous> (internal/child_process.js:342:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at Pipe._handle.close [as _onclose] (net.js:511:12)
  killed: false,
  code: 1,
  signal: null,
  cmd: 'bash node_modules/gulp-imageoptim/scripts/optimize.bash 06962c9b44b38b68736f1c7e7d8d2b81 ' }

Gulp does not exit and subsequent watch events execute properly, so functionally, everything is working fine. Just wondering if this error can be accounted for so my users don't get alarmed by scary-looking errors in their consoles. Or, if there's a way I should be handling this error on my side, let me know.

edit: for reference, I am using pump in place of pipe. Here's my imageOptim task:

let out = 'dist/images';
pump(
  [
    gulp.src(imageFiles),
    newer(out),
    imageOptim.optimize(),
    gulp.dest(out)
  ],
  done
);

doesn't work with watch

Every time I use gulp watch with ImageOptim, it multiply the length of files by itself. For example:

  • 2 new files, it try to minify 4 files;
  • 3 new files, it try to minify 9 files;
  • 4 new files, it try to minify 16 files;

It only work well with one file per time.

My task:
gulp.watch(['src/images/**/*'], function(event) {
return gulp
.src('./src/images/**/*.{png,gif,jpg}')
.pipe(imageOptim.optimize())
.on('error', function (error) {
console.error(String(error));
})
.pipe(gulp.dest('./dist/img'));
});

Would you find out what it can be?

Thanks!

Optimization failing

Iโ€™m getting the following error when I try to run my images gulp task

{ [Error: Command failed: bash node_modules/gulp-imageoptim/scripts/optimize.bash b7548d98bb65523ae6d042877f679cec --jpegmini
]
  killed: false,
  code: 1,
  signal: null,
  cmd: 'bash node_modules/gulp-imageoptim/scripts/optimize.bash b7548d98bb65523ae6d042877f679cec --jpegmini' }

My gulp task looks like this:

gulp.task('images', () => {
    return gulp.src('dist/media/**/*')
        .pipe($.imageoptim.optimize({
            jpegmini: true
        }))
        .pipe(gulp.dest('shared/media'))
  });

Any thoughts on how I could debug the issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.