Socket
Socket
Sign inDemoInstall

postcss-opacity-percentage

Package Overview
Dependencies
4
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    postcss-opacity-percentage

PostCSS plugin to transform percentage-based opacity values to more compatible floating-point values.


Version published
Weekly downloads
3.9M
increased by1%
Maintainers
1
Install size
5.05 kB
Created
Weekly downloads
 

Readme

Source

PostCSS Opacity Percentage

Test Coverage Status Install size XO code style MIT license

PostCSS plugin to transform percentage-based opacity values to more compatible floating-point values.

Install

Using npm:

npm install --save-dev postcss postcss-opacity-percentage

Using yarn:

yarn add --dev postcss postcss-opacity-percentage

Example

/* Input */
.foo {
  opacity: 45%;
}
/* Output */
.foo {
  opacity: 0.45;
}

Usage

postcss([
  require('postcss-opacity-percentage'),
]);

See PostCSS documentation for examples for your environment.

postcss-preset-env

If you are using postcss-preset-env@>=7.3.0, you already have this plugin installed via this package.

Options

preserve

The preserve option determines whether the original percentage value is preserved. By default, it is not preserved.

// Keep the original notation
postcss([
  require('postcss-opacity-percentage')({preserve: true}),
]);
/* Input */
.foo {
  opacity: 45%;
}
/* Output */
.foo {
  opacity: 0.45;
  opacity: 45%;
}

License

MIT © Marc Görtz

Keywords

FAQs

Last updated on 31 Jan 2023

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