Configuration


The pattern library configuration is how you connect Warhol to your pattern library. It lets Warhol know where to find your pattern library on the web, which breakpoints the pattern library implements, which selectors to use to identify components and so on.

You can set up the configuration for a pattern library in the pattern library screen in the web app.

Summary of configuration options #

See the docs page for each configuration option for configuration examples.

Field patternLibUrl (a full URL) #

The full URL for the pattern library's main page ("kitchen sink") where all components, colors and typography examples can be found. This URL can be overruled for each component and theme configuration with their own URLs. If the pattern library URL is not specified or, components and themes (or sub-sections of themes) must provide their own URLs.

Field breakpoints (JSON list of numbers, defaults to [ 1000 ]) #

Breakpoints for the pattern library (and the production page that implements the pattern lib). This controls the screen widths at which snapshots for the components are taken.

Field components (list of component definitions or null, defaults to []) #

List of components to take snapshots of. A component definition is a JSON object with the following fields:

  • source (CSS selector string, required, non-empty): source selector
  • target (CSS selector string, optional, non-empty): target selector, defaults to the source selector
  • name (string or null, optional, non-empty): component name, defaults to null
  • componentUrl (URL string or null, optional or required depending on the pattern lib URL): this component's own URL, defaults to the pattern lib URL. If no pattern lib URL was specified, this field is required for each component.

Field theme (optional, JSON object or null, defaults to null) #

Theme configuration for colors, typography and icons. Details explained below.

Field theme.themeUrl (optional, URL string or null, defaults to the pattern lib URL) #

Theme URL, can be overruled by the URLs specified in the theme's sub-properties.

Field theme.colors (optional, JSON object or null, defaults to null) #

Configuration for theme colors with the following fields:

  • sources (CSS selector string, required, non-empty): selector for color source elements
  • properties (list of CSS color properties, optional, defaults to [ "background-color" ]): configures the CSS properties to use as a color source. CSS shorthand properties like background are not allowed.
  • colorsUrl (URL string or null, optional or required depending on the theme and pattern lib URLs, defaults to the theme or pattern lib URL): the URL for the color sources

The colorsUrl field is required if neither a pattern lib URL nor a theme URL have been specified.

Field theme.typography (optional, JSON object or null, defaults to null) #

Configuration for theme typography with the following fields:

  • sources (CSS selector string, required, non-empty): selector for elements that contain typography examples
  • properties (list of CSS color properties, optional, defaults to [ "font-family", "font-size", "font-weight", "font-style" ]): configures the CSS properties that define a typography example. CSS shorthand properties like font are not allowed.
  • typographyUrl (URL string or null, optional or required depending on the theme and pattern lib URLs, defaults to the theme or pattern lib URL): the URL for the typography examples

The typographyUrl field is required if neither a pattern lib URL nor a theme URL have been specified.

Field theme.icons (optional, JSON object or null, defaults to null) #

Configuration for theme icons with the following fields:

  • sources (CSS selector string, required, non-empty): selector for elements that contain icons
  • iconsUrl (URL string or null, optional or required depending on the theme and pattern lib URLs, defaults to the theme or pattern lib URL): the URL for the icon examples
  • isFont (boolean, required, non-empty): defines if icons are created using an icon font

The iconsUrl field is required if neither a pattern lib URL nor a theme URL have been specified.

Field utils (optional, JSON object or null, defaults to null) #

Definitions for style utilities (classes for alignment, layout, shadows and the like).

Field utils.utilsUrl (optional, URL string or null, defaults to the pattern lib URL) #

URL for style utilities, is only required if there is no top-level patternLibUrl.

Field utils.sources (required, array of JSON objects) #

Sources for utilities. Each utility is described by an object:

  • type (either "rule" or "element"): whether to read the utility styles from an element or from a CSS rule
  • selector (CSS selector string, required, non-empty): the selector for the style utility
  • name (string, optional, non-empty, defaults to null): utility name, defaults to null

Join our Slack Community

Any question not answered yet? You want to get the latest information on Warhol and discuss new features? Join our Slack Community.