Socket
Socket
Sign inDemoInstall

postcss-ordered-values

Package Overview
Dependencies
6
Maintainers
7
Versions
52
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    postcss-ordered-values

Ensure values are ordered consistently in your CSS.


Version published
Weekly downloads
11M
increased by2.85%
Maintainers
7
Install size
61.1 kB
Created
Weekly downloads
 

Package description

What is postcss-ordered-values?

The postcss-ordered-values npm package is a PostCSS plugin designed to optimize CSS by consistently ordering values within declarations. This can help in minimizing CSS size and improving readability and maintainability by ensuring a standardized order of values.

What are postcss-ordered-values's main functionalities?

Optimization of margin and padding values

This feature optimizes shorthand for margin and padding by collapsing redundant values. For example, if all four values of margin are the same, it simplifies it to a single value.

const postcss = require('postcss');
const orderedValues = require('postcss-ordered-values');

postcss([orderedValues()])
.process('a { margin: 1px 1px 1px 1px; }', { from: undefined })
.then(result => {
  console.log(result.css);
  // Output: 'a { margin: 1px; }'
});

Ordering of border values

This feature ensures the properties of borders are ordered consistently, typically width, style, and then color. This helps in maintaining a standard across your CSS files.

const postcss = require('postcss');
const orderedValues = require('postcss-ordered-values');

postcss([orderedValues()])
.process('a { border: solid 1px red; }', { from: undefined })
.then(result => {
  console.log(result.css);
  // Output: 'a { border: 1px solid red; }'
});

Other packages similar to postcss-ordered-values

Readme

Source

postcss-ordered-values

Ensure values are ordered consistently in your CSS.

Install

With npm do:

npm install postcss-ordered-values --save

Example

Some CSS properties accept their values in an arbitrary order; for this reason, it is entirely possible that different developers will write their values in different orders. This module normalizes the order, making it easier for other modules to understand which declarations are duplicates.

Input

h1 {
    border: solid 1px red;
    border: red solid .5em;
    border: rgba(0, 30, 105, 0.8) solid 1px;
    border: 1px solid red;
}

Output

h1 {
    border: 1px solid red;
    border: .5em solid red;
    border: 1px solid rgba(0, 30, 105, 0.8);
    border: 1px solid red;
}

Support List

For more examples, see the tests.

  • animation, -webkit-animation
  • border(border-left|right|top|bottom)
  • box-shadow
  • outline
  • flex-flow
  • transition, -webkit-transition

Usage

See the PostCSS documentation for examples for your environment.

Contributors

See CONTRIBUTORS.md.

License

MIT © Ben Briggs

Keywords

FAQs

Last updated on 18 Jun 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc