Giter VIP home page Giter VIP logo

Comments (16)

zauni avatar zauni commented on May 29, 2024

Thanks for the bug report!

I think you can resolve the problem if you would put a directory as the destination.
And I would recommend this options if you want to override the existing file with the optimized one:

pngmin: {
  compile: {
    options: {
      ext: '.png',
      force: true
    },
    src: '<%= paths.dist %><%= pkg.widget.name %>-sprite.png',
    dest: '<%= paths.dist %>'
  }
}

Could you please say if it worked that way? Thanks :)

And I will try to change the task, so that it will accept filenames and not just directories as the destination!

from pngmin.

zauni avatar zauni commented on May 29, 2024

Now it should be possible to use a path with filename as destination like this:

pngmin: {
  compile: {
    options: {
      ext: '.png',
      force: true
    },
    src: '<%= paths.dist %><%= pkg.widget.name %>-sprite.png',
    dest: '<%= paths.dist %><%= pkg.widget.name %>-sprite.png'
  }
}

Just update the pngmin task to v0.4.0.

from pngmin.

zauni avatar zauni commented on May 29, 2024

And maybe it would be good to install the latest version of pngquant from http://pngquant.org/
It's already in version 1.8.4 :)

from pngmin.

ryanunger avatar ryanunger commented on May 29, 2024

Hello again.

When I ran the first snippet your added, I received the following error:

Running "pngmin:compile" (pngmin) task
Fatal error: Unable to read "../../distribution/" file (Error code: EISDIR).

I'll update pngquant in the meantime, as that may potentially also be the culprit.

from pngmin.

ryanunger avatar ryanunger commented on May 29, 2024

p.s. I installed pngquant the first time using APT (via http://www.ubuntuupdates.org/package/core/raring/universe/base/pngquant) on Ubuntu 12.04.

from pngmin.

zauni avatar zauni commented on May 29, 2024

Unfortunately I can't reproduce the error...
Does it help if you install the newer version of pngquant? If not, can you post your Gruntfile again? Thanks :)

Which node version is installed in your system? (type node -v in your console, if you don't know it)

from pngmin.

zauni avatar zauni commented on May 29, 2024

I will close this issue now, as I hope/think that the new version of pngquant solved the issue for you.

from pngmin.

averyvery avatar averyvery commented on May 29, 2024

Getting the same issue with the following code:

pngmin: {
  compile: {
    files: [
      {
        src: 'compiled/images/components/characters__attribute-1x.png',
        dest: 'tmp/'
      }
    ]
  }
}

Stack output is:

Running "pngmin:compile" (pngmin) task
Verifying property pngmin.compile exists in config...OK
Files: compiled/images/components/characters__attribute-1x.png -> tmp/
Options: binary="/Users/davery/Sites/quarkgames/assets/node_modules/grunt-pngmin/node_modules/node-pngquant-bin/vendor/osx/pngquant", concurrency=4, colors=256, ext="-fs8.png", quality=null, force=false, speed=3, iebug=false, transbug=false
Reading compiled/images/components/characters__attribute-1x.png...OK
Writing /var/folders/f2/0kjqyzbd0vjd57vbbt9ntzvw0000gn/T/tmp-4239r4r79q8.png...OK
Fatal error: Reduce of empty array with no initial value
TypeError: Reduce of empty array with no initial value
    at Array.reduce (native)
    at Object.module.exports.grunt.registerMultiTask.queue.drain (/Users/davery/Sites/quarkgames/assets/node_modules/grunt-pngmin/tasks/pngmin.js:144:36)
    at async.queue.q.process (/Users/davery/Sites/quarkgames/assets/node_modules/grunt/node_modules/async/lib/async.js:613:72)
    at /Users/davery/Sites/quarkgames/assets/node_modules/grunt-pngmin/tasks/pngmin.js:73:21
    at util.spawn.callDone (/Users/davery/Sites/quarkgames/assets/node_modules/grunt/lib/grunt/util.js:147:5)
    at ChildProcess.util.spawn (/Users/davery/Sites/quarkgames/assets/node_modules/grunt/lib/grunt/util.js:186:5)
    at ChildProcess.EventEmitter.emit (events.js:99:17)
    at maybeClose (child_process.js:638:16)
    at Socket.ChildProcess.spawn.stdin (child_process.js:815:11)
    at Socket.EventEmitter.emit (events.js:96:17)
    at Socket._destroy.destroyed (net.js:357:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

This seems like the most basic version of the settings, so I'm wondering if the issue is something more than a mis-configuration...

from pngmin.

averyvery avatar averyvery commented on May 29, 2024

Looks like I fixed this by pointing the binary at my own pngquant, instead of letting it use the provided one. Works great, glad I found this plugin!

from pngmin.

zauni avatar zauni commented on May 29, 2024

Thanks for pointing this out. Unfortunately I don't have a Mac, so I have a bit of a problem to debug...
My guess is that the pngquant binary is not executable on Mac and then it's not spawned. I will try fs.chmodsync to change the permission of the binary before executing. Maybe you can test it out when it's ready.

from pngmin.

averyvery avatar averyvery commented on May 29, 2024

Sure, let me know how it goes. Would be happy to help test.

from pngmin.

zauni avatar zauni commented on May 29, 2024

Now I found the time to implement something. In the postinstall branch I built a small script which tries to change the permissions on the pngquant binary after one installs pngmin.
@averyvery could you make a new folder and execute this command in your shell: npm install git://github.com/zauni/pngmin.git#postinstall
After this, the permission on the file node_modules/grunt-pngmin/node_modules/node-pngquant-bin/vendor/osx/pngquant should be rwx------ or 700 as hexadecimal. Can you confirm that?

I would be happy if you could find the time to test that!

from pngmin.

averyvery avatar averyvery commented on May 29, 2024

Hmm, getting "zsh: no matches found: https://github.com/zauni/pngmin.git#postinstall" when trying to run that NPM install script in zsh. I haven't seen the #postinstall syntax for Git URLs before.

from pngmin.

zauni avatar zauni commented on May 29, 2024

The # is there to tell npm to install the code of the postinstall branch. And did you type https:// oder git:// because if you want to use https the url should be: git+https://github.com/zauni/pngmin.git#postinstall. Otherwise it's git://github.com/zauni/pngmin.git#postinstall

from pngmin.

averyvery avatar averyvery commented on May 29, 2024

Ah, just looks like I needed to quote the URL in zsh, it didn't like the #.

Looks like this fix works! Thanks for addressing it.

from pngmin.

zauni avatar zauni commented on May 29, 2024

Perfect :) Thanks for testing it out!

from pngmin.

Related Issues (15)

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.