npm.io
0.0.2 • Published 3 years ago

webpack-image-placeholder-plugin

Licence
MIT
Version
0.0.2
Deps
1
Size
4 kB
Vulns
2
Weekly
0
Stars
1

webpack-image-placeholder-plugin

In JavaScript, import "<width in pixel>x<height in pixel>.png"

import placeholder from "200x300.png";

const element = document.createElement("img");
element.src = placeholder;
document.body.appendChild(element);

This will generate image with specific width and height automatically.

image

Install

  npm i --save-dev webpack-image-placeholder-plugin
Webpack configuration
const ImagePlaceholderPlugin = require("webpack-image-placeholder-plugin");

module.exports = {
  // ...
  plugins: [new ImagePlaceholderPlugin()]
};

Keywords