Pattern Lab Node Events
September 14, 2018 · View on GitHub
Pattern Lab emits numerous events during the build process. Some uses of events:
- Core uses
patternlab-pattern-changeevents when watching for changes in order to trigger another build - Plugins such as plugin-tab can use an event like
patternlab-pattern-write-endto define additional code tabs to the pattern viewer / modal
Learn more about Creating Plugins.
Events
EVENTS ⏏
EVENTS~PATTERNLAB_BUILD_START
Emitted before any logic run inside build(), which is the entry point for single builds, pattern-only builds, run singly or when watched.
Kind: inner property of EVENTS
Properties
| Name | Type | Description |
|---|---|---|
| patternlab | object | global data store |
EVENTS~PATTERNLAB_BUILD_END
Emitted after all logic run inside build(), which is the entry point for single builds, pattern-only builds, run singly or when watched.
Kind: inner property of EVENTS
Properties
| Name | Type | Description |
|---|---|---|
| patternlab | object | global data store |
EVENTS~PATTERNLAB_PATTERN_ITERATION_END
Emitted after patterns are iterated over to gather data about them. Right before Pattern Lab processes and renders patterns into HTML
Kind: inner property of EVENTS
Properties
| Name | Type | Description |
|---|---|---|
| patternlab | object | global data store |
EVENTS~PATTERNLAB_BUILD_GLOBAL_DATA_END
Emitted after global data.json and listitems.json are read, and the supporting Pattern Lab templates are loaded into memory (header, footer, patternSection, patternSectionSubType, viewall). Right before patterns are iterated over to gather data about them.
Kind: inner property of EVENTS
Properties
| Name | Type | Description |
|---|---|---|
| patternlab | object | global data store |
EVENTS~PATTERNLAB_PATTERN_BEFORE_DATA_MERGE
Emitted before all data is merged prior to a Pattern's render. Global data.json is merged with any pattern .json. Global listitems.json is merged with any pattern .listitems.json.
Kind: inner property of EVENTS
See: Pattern
Properties
| Name | Type | Description |
|---|---|---|
| patternlab | object | global data store |
| pattern | Pattern | current pattern |
EVENTS~PATTERNLAB_PATTERN_WRITE_BEGIN
Emitted before a pattern's template, HTML, and encoded HTML files are written to their output location
Kind: inner property of EVENTS
See: Pattern
Properties
| Name | Type | Description |
|---|---|---|
| patternlab | object | global data store |
| pattern | Pattern | current pattern |
EVENTS~PATTERNLAB_PATTERN_WRITE_END
Emitted after a pattern's template, HTML, and encoded HTML files are written to their output location
Kind: inner property of EVENTS
See: Pattern
Properties
| Name | Type | Description |
|---|---|---|
| patternlab | object | global data store |
| pattern | Pattern | current pattern |
EVENTS~PATTERNLAB_PATTERN_ASSET_CHANGE
Invoked when a watched asset changes. Assets include anything in source/ that is not under ['root', 'patterns', 'data', 'meta', 'annotations', 'patternlabFiles'] which are blacklisted for specific copying.
Kind: inner property of EVENTS
Properties
| Name | Type | Description |
|---|---|---|
| fileInfo | object | {file: 'path/to/file.css', dest: 'path/to/destination'} |
EVENTS~PATTERNLAB_GLOBAL_CHANGE
Invoked when a watched global file changes. These are files within the directories specified in ['data', 'meta']paths.
Kind: inner property of EVENTS
Properties
| Name | Type | Description |
|---|---|---|
| fileInfo | object | {file: 'path/to/file.ext'} |
EVENTS~PATTERNLAB_PATTERN_CHANGE
Invoked when a pattern changes.
Kind: inner property of EVENTS
Properties
| Name | Type | Description |
|---|---|---|
| fileInfo | object | {file: 'path/to/file.ext'} |
Pattern Lab Node is MIT Licensed