Code Monkey home page Code Monkey logo

postcss-opacity-percentage's Introduction

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

postcss-opacity-percentage's People

Contributors

dependabot[bot] avatar mrcgrtz avatar romainmenke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

postcss-opacity-percentage's Issues

PostCSS Opacity Percentage engine support

Hi there!

We've just integrated postcss-opacity-percentage into postcss-preset-env. We've started to get issues because the plugin right now indicates that it only works on Node >= 16 as per https://github.com/mrcgrtz/postcss-opacity-percentage/blob/main/package.json#L28-L30

Right now we're following what PostCSS is currently supporting which is every LTS version of Node.

Which would look like:

"engines": {
   "node": "^12 || ^14 || >=16"
}

Are you open to fix this and/or get a PR to update this?

See csstools/postcss-plugins#218 for more context

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.