imagemin-lint-staged: in-place minify the images before adding to the git repo

Lost in Space
@tomchentw/software
1 min readNov 14, 2017

imagemin-lint-staged is a tool designed to be used with lint-staged, which giving you:

  • in-place minify the images before adding to the git repo
  • with minified images, you can remove minify step in your bundler config (webpack, gulp, Grunt……)
  • bundleTime--, buildSpeed++

Try it now! First,

npm install --save-dev lint-staged imagemin-lint-staged

Then, add this to your package.json:

  "lint-staged": {
"*.{png,jpeg,jpg,gif,svg}": ["imagemin-lint-staged", "git add"]
},

All done.

--

--

Lost in Space
@tomchentw/software

<Tom Chen> Aspie. Introvert. Remoter. Blogger. 「從程式碼的26個英文字母到文章的26個英文字母,開始發現寫作的魅力。」