How to use fela-plugin-fallback-value - 1 common examples

To help you get started, we’ve selected a few fela-plugin-fallback-value 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 robinweser / fela / packages / fela-plugin-prefixer / src / index.js View on Github external
/* @flow */
import prefix from 'inline-style-prefixer/static'
import cssifyObject from 'css-in-js-utils/lib/cssifyObject'
import objectReduce from 'fast-loops/lib/objectReduce'

import fallbackValue from 'fela-plugin-fallback-value'

function isPlainObject(obj: any): boolean {
  return typeof obj === 'object' && !Array.isArray(obj)
}

const resolveFallbackValues = fallbackValue()

function addVendorPrefixes(style: Object): Object {
  return objectReduce(
    style,
    (prefixedStyle, value, property) => {
      if (isPlainObject(value)) {
        prefixedStyle[property] = addVendorPrefixes(value)
      } else {
        const prefixedDeclaration = prefix({
          [property]: style[property],
        })
        const styleKeys = Object.keys(prefixedDeclaration)

        const referenceProperty = styleKeys[0]
        const referenceValue = prefixedDeclaration[referenceProperty]

fela-plugin-fallback-value

Fela plugin to resolve fallback values

MIT
Latest version published 2 years ago

Package Health Score

75 / 100
Full package analysis

Popular fela-plugin-fallback-value functions