Project

img-lint

0.0
No commit activity in last 3 years
No release in over 3 years
img-lint detects big images in your project
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.12
>= 0
~> 12.3
~> 3.0
 Project Readme

Gem Version Build Status Maintainability Coverage Status Inline docs

img-lint logo

img-lint will help to keep your webapp from serving heavy and not optimized images. It's a zero-dependencies Ruby gem that will scan specified folders for images with size above a certain threshold. It could be run manually or easily integrated into CI.

Installation

gem install img-lint

or add it to your Gemfile and run bundle install:

gem 'img-lint', require: false

Usage

Run img-lint in your console to lint images in the current folder or pass some arguments like so:

img-lint -p /path/to/project -f "jpg,png" -m 30
Command Line Flag Description
-p/--path Path to a folder with images
-m/--max-size Max image size allowed in Kb
-f/--format Image formats, 'jpg,png,gif' by default
-h/--help Show help

Configuration

Run img-lint install from the command line to generate .img-lint.yml config file:

max_file_size: 150 # Kb
image_formats: "jpg,png,gif"
exclude:
  - "tmp/**/**"
  - "vendor/**/**"

Configuration from .img-lint.yml will extend the default configuration.

Rake integration

To execute scss-lint via a Rake task, add the following to your Rakefile:

require "img_lint/rake_task"

IMGLint::RakeTask.new

Make sure to specify your config when running img-lint with Rake or in CI mode.

Contributing

That would be awesome to see you involved: Try out img-lint, give feedback via email or simply open an issue. If you're opening a PR, try to add some specs, so we keep the project stable:

bundle exec rspec

By participating, you are expected to honor Code of Conduct.

License

This project is released under the MIT License.