JamieMason / ImageOptim-CLI

Make optimisation of images part of your automated build process
https://foldleft.io/image-tools
MIT License
3.45k stars 126 forks source link

Help with Pre-commit hook #149

Closed awebdeveloper closed 6 years ago

awebdeveloper commented 7 years ago

I am trying to creating a pre-commit hook for this and i am stuck. The lack of filename as an arg is the contention. If you could chip in with any help it will be great

Here is the conversation where you can pitch in https://github.com/pre-commit/pre-commit/issues/547

and here is the repo https://github.com/awebdeveloper/pre-commit-imageoptim

awebdeveloper commented 7 years ago

Reopening to see if you can provide any help/comment

paleite commented 6 years ago

@awebdeveloper Maybe not what you're looking for, but you could have a shell-script like so: echo "$1" | imageoptim --jpeg-mini --quit

and call it from the pre-commit hook, like so: sh imageoptim.sh FILENAME

awebdeveloper commented 6 years ago

thanks @paleite i managed to fix it.

If you can help me find a way to pass args then help me here

https://github.com/awebdeveloper/pre-commit-imageoptim/issues/1