Skip to content
This repository has been archived by the owner on Nov 12, 2017. It is now read-only.

Latest commit

 

History

History
33 lines (25 loc) · 1.72 KB

Plugins.md

File metadata and controls

33 lines (25 loc) · 1.72 KB

Plugins

Note: If you've been using Look before version 0.5 plugins have basically be named 'processors'.

Style modifications of any kind are done using plugins. Plugins are triggered directly before styles get passed to the final element.
Every plugin should only do one single job. If there are multiple modifications to do, use multiple plugins.

Parameters

Every plugin gets called with a set of parameters which include several information to achieve almost any usecase.

Parameter Type Description 
 styles object the full style object provided with the look property
scopeArgs object - wrapping React Component
- rendered element
- newProps to clone the element
- parent element (if existing)
config object Contains configuration settings such as plugins, userAgent or custom property declarations
  • mixin
    Define custom properties using a key-value mapping.
    config key: mixins

  • alternativeValue
    Use an array of values to define alternatives/fallbacks.
    e.g. flex: ['-webkit-flex', 'flex']

  • statefulValue
    Use props, state and context values by passing a function instead of a value.
    e.g. color: (props, state, context) => props.color

  • prefixer
    Automatically adds vendor prefixes according your userAgent and caniuse-database.
    It uses inline-style-prefixer to do this on-the-go using the userAgent information.
    config key: userAgent (optional)