What is postcss-normalize-repeat-style?
The postcss-normalize-repeat-style npm package is a PostCSS plugin designed to normalize repeat styles in CSS. This includes simplifying repeat style values in background and background-image properties to use the shorthand form when possible, improving both the readability and efficiency of the CSS.
What are postcss-normalize-repeat-style's main functionalities?
Normalize repeat styles for background
This feature automatically converts longhand repeat styles for the background property into their shorthand form, making the CSS cleaner and more concise.
"background: repeat no-repeat" becomes "background: repeat-x"
Optimize background-image repeat styles
For background images with repeat styles, this plugin optimizes the declaration by merging them into a single, shorthand property, enhancing the efficiency of the CSS.
"background-image: url('image.png'); background-repeat: repeat no-repeat" becomes "background: url('image.png') repeat-x"
Other packages similar to postcss-normalize-repeat-style
cssnano
cssnano is a modular CSS minifier that includes functionalities similar to postcss-normalize-repeat-style as part of its optimizations. It compresses CSS by normalizing styles, including repeat styles, but offers a broader range of optimizations beyond what postcss-normalize-repeat-style provides.
postcss-merge-longhand
postcss-merge-longhand is a PostCSS plugin that merges longhand properties into shorthand where possible, similar to how postcss-normalize-repeat-style optimizes repeat styles. While it covers a wider range of properties, its approach to optimizing repeat styles in background and background-image properties is similar.
postcss-normalize-repeat-style
Normalize repeat styles with PostCSS.
Install
With npm do:
npm install postcss-normalize-repeat-style --save
Example
Input
h1 {
background: url(image.jpg) repeat no-repeat
}
Output
h1 {
background: url(image.jpg) repeat-x
}
Usage
See the PostCSS documentation for
examples for your environment.
Contributors
See CONTRIBUTORS.md.
License
MIT © Ben Briggs