Giter Club home page Giter Club logo

imagemin-lint-staged's Introduction

imagemin-lint-staged

imagemin CLI designed for lint-staged usage with sensible defaults

Version PR Workflow

Installation

npm i --save-dev imagemin-lint-staged

Usage

Use in conjuntion with lint-staged. In your package.json

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

Options

N/A

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

imagemin-lint-staged's People

Contributors

ahmadalfy avatar tomchentw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

imagemin-lint-staged's Issues

"Check" Mode

Imaginemin currently only performs fixes...this is unusable for automated presubmit (pre-merge) checks. Although I am admittedly not very good with JS, I get the impression it would be pretty straightforward to add a parameter-controlled mode that compares the result of compression to the original file instead of writing to it. If the two are different, it would simply return in error.

If I find time, I will make the change and create a pull request. Allow me to reiterate, though, that I am inexperienced with JS and my implementation is likely to be ugly.

imagemin-lint-staged treats `--` as path

I'm getting following error, when I try to commit png file:

$ git add ./image.png 
$ git commit -m wip

> husky - npm run -s precommit
> husky - node v9.10.1

 ❯ Running tasks for *.{png,jpeg,jpg,gif,svg}
   ⠙ imagemin-lint-staged
 ❯ Running tasks for *.{png,jpeg,jpg,gif,svg}
   ⠹ imagemin-lint-staged
 ❯ Running tasks for *.{png,jpeg,jpg,gif,svg}
   ⠸ imagemin-lint-staged
 ❯ Running tasks for *.{png,jpeg,jpg,gif,svg}
   ⠼ imagemin-lint-staged
 ❯ Running tasks for *.{png,jpeg,jpg,gif,svg}
   ⠴ imagemin-lint-staged
 ❯ Running tasks for *.{png,jpeg,jpg,gif,svg}
   ✖ imagemin-lint-staged
     → { Error: ENOENT: no such file or directory, open '--' errno: -2, code: 'ENOENT', syscall: 'open', path: '--' }
     git add
 ↓ Running tasks for *.less [skipped]
   → No staged files match *.less
 ↓ Running tasks for hhmobile/static/js/**/*.js [skipped]
   → No staged files match hhmobile/static/js/**/*.js
 ↓ Running tasks for *.py [skipped]
   → No staged files match *.py
 ↓ Running tasks for package.json [skipped]
   → No staged files match package.json
🚫 imagemin-lint-staged found some errors. Please fix them and try committing again.

{ Error: ENOENT: no such file or directory, open '--' errno: -2, code: 'ENOENT', syscall: 'open', path: '--' }

imagemin-lint-staged -- image.png gives me the almost same output, so it seems more like a imagemin-lint-staged problem:

$ imagemin-lint-staged -- image.png 
{ Error: ENOENT: no such file or directory, open '--' errno: -2, code: 'ENOENT', syscall: 'open', path: '--' }

No way of overriding defaults

There is no way to override the defaults. This is a problem in our case because imagemin-svgo by default strips all IDs and we need them.

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.