
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
postcss-merge-longhand
Advanced tools
The postcss-merge-longhand package is a PostCSS plugin that merges longhand CSS properties into shorthand properties. This helps in reducing the size of the CSS by combining multiple longhand properties into a single shorthand property where possible.
Merge Margin Properties
This feature merges individual margin properties (margin-top, margin-right, margin-bottom, margin-left) into a single shorthand margin property.
/* Input CSS */
{
margin-top: 10px;
margin-right: 20px;
margin-bottom: 10px;
margin-left: 20px;
}
/* Output CSS */
{
margin: 10px 20px;
}
Merge Padding Properties
This feature merges individual padding properties (padding-top, padding-right, padding-bottom, padding-left) into a single shorthand padding property.
/* Input CSS */
{
padding-top: 5px;
padding-right: 10px;
padding-bottom: 5px;
padding-left: 10px;
}
/* Output CSS */
{
padding: 5px 10px;
}
Merge Border Properties
This feature merges individual border properties (border-width, border-style, border-color) into a single shorthand border property.
/* Input CSS */
{
border-width: 1px;
border-style: solid;
border-color: black;
}
/* Output CSS */
{
border: 1px solid black;
}
cssnano is a modular minifier that optimizes CSS for production. It includes a variety of plugins, including one for merging longhand properties into shorthand. cssnano is more comprehensive and includes many other optimizations beyond just merging longhand properties.
clean-css is a fast and efficient CSS optimizer that can also merge longhand properties into shorthand. It provides a wide range of optimization options and is known for its speed and efficiency.
csso (CSS Optimizer) is a CSS minifier that performs structural optimization of CSS files. It includes functionality to merge longhand properties into shorthand, along with other optimizations to reduce the size of CSS files.
Merge longhand properties into shorthand with PostCSS.
With npm do:
npm install postcss-merge-longhand --save
Merge longhand properties into shorthand; works with margin
, padding
&
border
. For more examples see the tests.
h1 {
margin-top: 10px;
margin-right: 20px;
margin-bottom: 10px;
margin-left: 20px;
}
h1 {
margin: 10px 20px;
}
See the PostCSS documentation for examples for your environment.
See CONTRIBUTORS.md.
MIT © Ben Briggs
FAQs
Merge longhand properties into shorthand with PostCSS.
The npm package postcss-merge-longhand receives a total of 7,414,416 weekly downloads. As such, postcss-merge-longhand popularity was classified as popular.
We found that postcss-merge-longhand demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.