postcss-opacity-percentage (1.1.3)

Published 2026-02-24 14:03:15 +00:00 by atheaadmin

Installation

registry=
npm install postcss-opacity-percentage@1.1.3
"postcss-opacity-percentage": "1.1.3"

About this package

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

Dependencies

Development Dependencies

ID Version
ava ^4.0.1
c8 ^7.10.0
clean-publish ^4.0.0
husky ^8.0.0
lint-staged ^13.0.0
postcss ^8.4.5
xo ^0.52.2

Peer Dependencies

ID Version
postcss ^8.2

Keywords

postcss css postcss-plugin opacity
Details
npm
2026-02-24 14:03:15 +00:00
1
Marc Görtz
MIT
latest
2.3 KiB
Assets (1)
Versions (1) View all
1.1.3 2026-02-24