How to use the inline-style-prefixer/lib/createPrefixer function in inline-style-prefixer

To help you get started, we’ve selected a few inline-style-prefixer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Khan / aphrodite / src / generate.js View on Github external
/* @flow */
import createPrefixer from 'inline-style-prefixer/lib/createPrefixer';
import staticData from '../lib/staticPrefixData';

import OrderedElements from './ordered-elements';
import {
    kebabifyStyleName,
    stringifyValue,
    stringifyAndImportantifyValue
} from './util';

const prefixAll = createPrefixer(staticData);

/* ::
import type { SheetDefinition } from './index.js';
type StringHandlers = { [id:string]: Function };
type SelectorCallback = (selector: string) => string[];
export type SelectorHandler = (
    selector: string,
    baseSelector: string,
    callback: SelectorCallback
) => string[] | string | null;
*/

/**
 * `selectorHandlers` are functions which handle special selectors which act
 * differently than normal style definitions. These functions look at the
 * current selector and can generate CSS for the styles in their subtree by
github necolas / react-native-web / packages / react-native-web / src / modules / prefixStyles / index.js View on Github external
/**
 * Copyright (c) Nicolas Gallagher.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import createPrefixer from 'inline-style-prefixer/lib/createPrefixer';
import staticData from './static';

const prefixAll = createPrefixer(staticData);

export default prefixAll;

export const prefixInlineStyles = (style: Object) => {
  const prefixedStyles = prefixAll(style);

  // React@15 removed undocumented support for fallback values in
  // inline-styles. Revert array values to the standard CSS value
  Object.keys(prefixedStyles).forEach(prop => {
    const value = prefixedStyles[prop];
    if (Array.isArray(value)) {
      prefixedStyles[prop] = value[value.length - 1];
    }
  });

  return prefixedStyles;