A PostCSS plugin to add CSS rules
width
andheight
forbackground-image
automatically.
$ yarn add postcss-background-image-auto-size --dev
// postcss.config.js
const autoSize = require('postcss-background-image-auto-size');
module.exports = {
plugins: [
autoSize(),
],
};
/* Before */
.logo {
background-image: url('./images/logo.png');
}
/* After */
.logo {
background-image: url('./images/logo.png');
width: 400px;
height: 400px;
}
Licensed under the MIT License