Skip to content

Common Configuration Sections

Todd Schiller edited this page Nov 5, 2020 · 12 revisions

metadata

The metadata section provides basic identifying information about the brick.

metadata:
  # The unique id for the brick. Must be lower-case and of one of the following forms:
  id: github/profile
  
  # The semantic version of the brick, cf. https://semver.org/
  version: 0.0.1
  
  # A unique name for the brick
  name: Github Profile Reader
  
  # A longer description for the brick
  description: Read information from a Github user profile

metadata.id

A brick's id is it's unique id in the PixieBrix ecosystem. An id is lower-case with letters a-z. An id may also include hyphens. A brick's id can also include a collection. Collections are used to namespace bricks that provide similar functionality.

Public bricks id structure:

  • <name>
  • <collection>/<name>

Individuals and teams can also select an identifier that they can use to namespace their bricks. These bricks can be shared with other teams, or published publicly.

Private/shared bricks id structure:

  • <@organization>/<collection>/<name>: e.g., @pixiebrix/browser/open-tab
  • <@organization>/<name>: e.g., @pixiebrix/get
  • <@username>/<collection>/<name>
  • <@username>/<name>

The @local namespace is reserved for bricks created locally in the extension, and not shared anywhere

isAvailable

The isAvailable entry specifies when the brick is available and can be run. The isAvailable section is used in the following kinds of bricks:

  • Foundations (kind extensionPoint)
  • Readers (kind reader)
  • Services (kind service). Only matchPatterns; see note below on matchPattern target
isAvailable:
  
  # A match pattern or array of match patterns. The brick will be available if _any_ of the patterns match
  # If you want to match all URLs for a given domain, be sure to put a glob * at the end of the URL
  matchPatterns: https://github.com/*
  
  # This property does not apply to service configurations
  selectors: ".user-profile-sticky-bar"

isAvailable.matchPatterns

A match pattern or array of match patterns. The brick/service will be available if any of the patterns match. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns#Examples

For services, the match pattern is applied to the request URL. (i.e., as opposed to the URL where the bricks are being executed.)

isAvailable.selectors

Optionally provide one or more JQuery selectors that must be present on the page for the brick to be available.

For performance considerations of different selectors, see here: Optimize Selectors