JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2068
  • Score
    100M100P100Q111584F
  • License MIT

Add vendor-specific prefixes to React styles

Package Exports

  • react-prefixer

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-prefixer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-prefixer

react-prefixer is a tiny package designed to provide vender-specific prefixes to the style objects you use in your React project. It's usage is pretty straightforward:

var prefix = require("react-prefixer"),
    styles = prefix({
      userSelect:"none"
    });
    
console.log(styles); // {WebkitUserSelect:"none"}

It also works on deeply-nested objects:

var prefix = require("react-prefixer"),
    styles = prefix({
      some:{
        really:{
          deep:{
            style:{
              userSelect:"none"
            }
          }
        }
      }
    });
    
console.log(styles); // {some:{really:{deep:{style:{WebkitUserSelect:"none"}}}}}

And will appropriately modify your values for legacy syntaxes on transition:

var prefix = require("react-prefixer"),
    styles = prefix({
      transition:"transform 200ms"
    });
    
console.log(styles); // {WebkitTransition:"-webkit-transform 200ms"}, if on Safari for example

It will also do the tweener or most recent vendor syntax for flexbox:

var prefix = require("react-prefixer"),
    styles = prefix({
      display:"flex"
    });
    
console.log(styles); 
// {display:"-webkit-flex"}, if on Safari
// {display:"-ms-flexbox"}, if on IE10

Browser support:

  • IE10+ and Edge
  • Firefox
  • Chrome
  • Safari
  • Opera

Happy prefixing!