Style
/ API Reference / Plugins
Style
/ API Reference / Plugins

sortProperty

This plugin sorts properties according to a property priority map.

The Gist

import { sortPropertyPlugin } from '@weser/style'

// this ensures longhand margin properties always take precedence
// over the shorthand 'margin' property
const plugin = sortPropertyPlugin({
  marginLeft: 2,
  marginRight: 2,
  marginTop: 2,
  marginBottom: 2,
})

Parameters

ParameterTypeDefaultDescription
propertyPriorityRecord<keyof T_Style, number>The property priority map. The higher the number, the higher the priority.

Returns

(Plugin) A plugin function that can be passed to the createRenderer function.

On this page