patternlab-node can be required within any Node environment, taking in a configuration file at instantiation.
const config = require('./patternlab-config.json');
const patternlab = require('patternlab-node')(config);Pattern Lab emits numerous events.
Many of these functions are exposed to users within Editions, but direct consumption is also encouraged.
Returns the standardized default config used to run Pattern Lab. This method can be called statically or after instantiation.
Returns: object - Returns the object representation of the patternlab-config.json
Logs current version to standard output
Returns: void - current patternlab-node version as defined in package.json
Returns current version
Returns: string - current patternlab-node version as defined in package.json, as string
Builds patterns, copies assets, and constructs user interface
Returns: Promise - a promise fulfilled when build is complete
| Param | Type | Description |
|---|---|---|
| options | object |
an object used to control build behavior |
| options.cleanPublic | bool |
whether or not to delete the configured output location (usually public/) before build |
| options.data | object |
additional data to be merged with global data prior to build |
| options.watch | bool |
whether or not Pattern Lab should watch configured source/ directories for changes to rebuild |
Returns the standardized default config used to run Pattern Lab. This method can be called statically or after instantiation.
Returns: object - Returns the object representation of the patternlab-config.json
Returns all file extensions supported by installed PatternEngines
Returns: Array.<string> - all supported file extensions
Logs usage to standard output
Returns: void - pattern lab API usage, as console output
Installs plugin already available via node_modules/
| Param | Type | Description |
|---|---|---|
| pluginName | string |
name of plugin |
Fetches starterkit repositories from pattern-lab github org that contain 'starterkit' in their name
Returns: Promise - Returns an Array<{name,url}> for the starterkit repos
Loads starterkit already available via node_modules/
| Param | Type | Description |
|---|---|---|
| starterkitName | string |
name of starterkit |
| clean | boolean |
whether or not to delete contents of source/ before load |
Builds patterns only, leaving existing user interface files intact
Returns: Promise - a promise fulfilled when build is complete
| Param | Type | Description |
|---|---|---|
| options | object |
an object used to control build behavior |
| options.cleanPublic | bool |
whether or not to delete the configured output location (usually public/) before build |
| options.data | object |
additional data to be merged with global data prior to build |
Build patterns, copies assets, and constructs user interface. Watches configured source/ directories, and serves all output locally
Returns: Promise - a promise fulfilled when build is complete
| Param | Type | Description |
|---|---|---|
| options | object |
an object used to control build behavior |
| options.cleanPublic | bool |
whether or not to delete the configured output location (usually public/) before build |
| options.data | object |
additional data to be merged with global data prior to build |
| options.watch | bool |
ALWAYS OVERRIDDEN to true whether or not Pattern Lab should watch configured source/ directories for changes to rebuild |
Pattern Lab Node is MIT Licensed