1.0.6 • Published 11 months ago

responsive-image-plugin v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

responsive-image-plugin

A webpack plugin for responsive images.

Installation

npm install responsive-image-plugin --save-dev

Usage

var OptimizeImagePlugin = require("responsive-image-plugin");

module.exports = {
  // ...
  plugins: [
    new OptimizeImagePlugin({
      test: /\.(png|gif|ico|jpg|jpeg)$/,
      options: {
        sourcePath: path.resolve(__dirname, "public"),
        outputPath: path.resolve(__dirname, "optimize-images"),
        sizes: [375, 768, 1280],
        quality: 80,
        overrideExtension: true,
      },
    }),
  ],
};

Options

OptionTypeDefaultDescription
sourcePathstringundefinedThe directory containing the images to be generated
outputPathstringundefinedThe directory containing the images to be exported
sizesarray[375, 768, 1280]The image sizes you want to generate
qualityinteger80The quality of the image

Examples

Before running webpack

 Project
  |_ src
  |_ public
  |   |_ image1.jpg
  |   |_ image2.jpg

After running webpack

 Project
  |_ src
  |_ public
  |   |_ image1.jpg
  |   |_ image2.jpg
  |_ optimize-images
  |   |_ image1-375x476.webp
  |   |_ image1-768x976.webp
  |   |_ image1-1220x1626.webp
  |   |_ image2-375x476.webp
  |   |_ image2-768x976.webp
  |   |_ image2-1220x1626.webp

License

MIT

1.0.6

11 months ago

1.0.5

12 months ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago