|
| 1 | + |
| 2 | +# Pattern Lab Node API |
| 3 | + |
| 4 | +``` javascript |
| 5 | + |
| 6 | +const config = require('./patternlab-config.json'); |
| 7 | +const patternlab = require('patternlab-node')(config); |
| 8 | + |
| 9 | +``` |
| 10 | + |
| 11 | +## `build(options)` ⇒ <code>Promise</code> |
| 12 | + |
| 13 | + build patterns, copy assets, and construct ui |
| 14 | + |
| 15 | +**Returns**: <code>Promise</code> - a promise fulfilled when build is complete |
| 16 | + |
| 17 | +| Param | Type | Description | |
| 18 | +| --- | --- | --- | |
| 19 | +| options | <code>object</code> | an object used to control build behavior | |
| 20 | + |
| 21 | +## `getDefaultConfig()` ⇒ <code>object</code> |
| 22 | + |
| 23 | + Returns the standardized default config |
| 24 | + |
| 25 | +**Returns**: <code>object</code> - Returns the object representation of the patternlab-config.json |
| 26 | +## `getSupportedTemplateExtensions()` ⇒ <code>Array.<string></code> |
| 27 | + |
| 28 | + returns all file extensions supported by installed PatternEngines |
| 29 | + |
| 30 | +**Returns**: <code>Array.<string></code> - all supported file extensions |
| 31 | +## `help()` ⇒ <code>void</code> |
| 32 | + |
| 33 | + logs usage |
| 34 | + |
| 35 | +**Returns**: <code>void</code> - pattern lab API usage, as console output |
| 36 | +## `installplugin(pluginName)` ⇒ <code>void</code> |
| 37 | + |
| 38 | + install plugin already available via `node_modules/` |
| 39 | + |
| 40 | + |
| 41 | +| Param | Type | Description | |
| 42 | +| --- | --- | --- | |
| 43 | +| pluginName | <code>string</code> | name of plugin | |
| 44 | + |
| 45 | +## `liststarterkits()` ⇒ <code>Promise</code> |
| 46 | + |
| 47 | + fetches starterkit repos from pattern-lab github org that contain 'starterkit' in their name |
| 48 | + |
| 49 | +**Returns**: <code>Promise</code> - Returns an Array<{name,url}> for the starterkit repos |
| 50 | +## `loadstarterkit(starterkitName, clean)` ⇒ <code>void</code> |
| 51 | + |
| 52 | + load starterkit already available via `node_modules/` |
| 53 | + |
| 54 | + |
| 55 | +| Param | Type | Description | |
| 56 | +| --- | --- | --- | |
| 57 | +| starterkitName | <code>string</code> | name of starterkit | |
| 58 | +| clean | <code>boolean</code> | whether or not to delete contents of source/ before load | |
| 59 | + |
| 60 | +## `v()` ⇒ <code>string</code> |
| 61 | + |
| 62 | + return current version |
| 63 | + |
| 64 | +**Returns**: <code>string</code> - current patternlab-node version as defined in package.json, as string |
| 65 | +## `version()` ⇒ <code>void</code> |
| 66 | + |
| 67 | + logs current version |
| 68 | + |
| 69 | +**Returns**: <code>void</code> - current patternlab-node version as defined in package.json, as console output |
| 70 | +## `patternsonly(options)` ⇒ <code>Promise</code> |
| 71 | + |
| 72 | + build patterns only, leaving existing public files intact |
| 73 | + |
| 74 | +**Returns**: <code>Promise</code> - a promise fulfilled when build is complete |
| 75 | + |
| 76 | +| Param | Type | Description | |
| 77 | +| --- | --- | --- | |
| 78 | +| options | <code>object</code> | an object used to control build behavior | |
| 79 | + |
| 80 | +## `serve(options)` ⇒ <code>Promise</code> |
| 81 | + |
| 82 | + build patterns, copy assets, and construct ui, watch source files, and serve locally |
| 83 | + |
| 84 | +**Returns**: <code>Promise</code> - TODO: validate |
| 85 | + |
| 86 | +| Param | Type | Description | |
| 87 | +| --- | --- | --- | |
| 88 | +| options | <code>object</code> | an object used to control build, copy, and serve behavior | |
| 89 | + |
| 90 | +* * * |
| 91 | + |
| 92 | +[Pattern Lab](http://patternlab.io) Node is [MIT Licensed](https://github.com/pattern-lab/patternlab-node/blob/master/LICENSE) |
0 commit comments