Check your CSS images to improve the performance and avoid common mistakes (plugin pack).
Switch branches/tags
Clone or download
Latest commit 59191db Feb 26, 2018


NPM version Build Status

A collection of rules to check images for stylelint (in a form of a plugin).

Table of Contents


stylelint-images is a plugin for stylelint, so it's meant to be used with it.

Node.js v6 or newer is required. That's because stylelint itself doesn't support Node.js versions below 6.

First, install stylelint-images (and stylelint, if you haven't done so yet) via NPM:

npm install -D stylelint@^9.1.0 stylelint-images

Or if you use Yarn:

yarn add stylelint@^9.1.0 stylelint-images -D


Create the .stylelintrc.json config file (or open the existing one), add stylelint-images to the plugins array and the rules you need to the rules list. All rules from stylelint-images need to be namespaced with images.

  "plugins": [
  "rules": {
    "images/broken": true,
    "images/prefer-data-uri": 256,

Please refer to stylelint docs for the detailed info on using this linter.

List of rules

  • broken: Checks if the images are broken.
  • prefer-data-uri: Suggest using data-URIs instead of an external image if its file size (in bytes) is smaller than the limit.


Feel free to dive in! Open an issue or submit PRs.

stylelint-images follows the Contributor Covenant Code of Conduct.


stylelint-images is MIT licensed.