Skip to content

Commit 117e05e

Browse files
committed
finish updates
closes #724
1 parent 36093c7 commit 117e05e

File tree

1 file changed

+55
-9
lines changed

1 file changed

+55
-9
lines changed

README.md

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,83 @@ Pattern Lab Node wouldn't be what it is today without the support of the communi
2121

2222
## Installation
2323

24-
Pattern Lab Node can be worked with a couple different ways.
24+
Pattern Lab Node can be used different ways. Editions are **example** pairings of Pattern Lab code and do not always have an upgrade path or simple means to run as a dependency within a larger project. Users wishing to be most current and have the greatest flexibility are encouraged to consume `patternlab-node` directly. Users wanting to learn more about Pattern Lab and have a tailored default experience are encouraged to start with an Edition. Both methods still expect to interact with other elements of the [Pattern Lab Ecosystem](#ecosystem).
2525

26-
As of Pattern Lab Node 3.X, `patternlab-node` can run standalone, in conjunction with the rest of the [Pattern Lab Ecosystem](http://patternlab.io/docs/advanced-ecosystem-overview.html) elements.
26+
### Direct Consumption
2727

28+
As of Pattern Lab Node 3.X, `patternlab-node` can run standalone, without the need for task runners like gulp or grunt.
2829

30+
`npm install patternlab-node`
2931

32+
See [Usage](#Usage) for more information.
3033

34+
### Editions
3135

3236
For users wanting a more pre-packaged experience several editions are available.
3337

3438
* [Pattern Lab/Node: Gulp Edition](https://github.com/pattern-lab/edition-node-gulp) contains info how to get started within a Gulp task running environment.
3539
* [Pattern Lab/Node: Grunt Edition](https://github.com/pattern-lab/edition-node-grunt) contains info how to get started within a Grunt task running environment.
3640
* [Pattern Lab/Node: Vanilla Edition](https://github.com/pattern-lab/edition-node) contains info how to get started within a pure node environment.
37-
* [Pattern Lab/Node: Webpack Edition](https://github.com/Comcast/patternlab-edition-node-webpack) contains info how to get started within a webpack environment. Thanks to Comcast for open-sourcing this stellar work!
41+
* [Pattern Lab/Node: Webpack Edition](https://github.com/Comcast/patternlab-edition-node-webpack) contains info how to get started within a webpack environment.
42+
>Thanks to the team at Comcast for open-sourcing this stellar work!
43+
44+
## Ecosystem
3845

3946
![Pattern Lab Ecosystem](http://patternlab.io/assets/pattern-lab-2-image_18-large-opt.png)
4047

4148
Core, and Editions, are part of the [Pattern Lab Ecosystem](http://patternlab.io/docs/advanced-ecosystem-overview.html). With this architecture, we encourage people to write and maintain their own Editions, Starterkits, and even PatternEngines.
4249

4350
## Usage
4451

52+
`patternlab-node` can be required within any Node environment, taking in a configuration file at instantiation.
53+
4554
``` javascript
55+
4656
const config = require('./patternlab-config.json');
4757
const patternlab = require('patternlab-node')(config);
48-
patternlab.build(doneCallBack, boolCleanOutputDir);
58+
59+
60+
// build, optionally watching or choosing incremental builds
61+
patternlab.build({
62+
cleanPublic: true,
63+
watch: true
64+
});
65+
66+
// or build, watch, and then self-host
67+
patternlab.serve({
68+
cleanPublic: true
69+
});
70+
4971
```
5072

51-
* Read more about configuration via `patternlab-config.json`: https://github.com/pattern-lab/patternlab-node/wiki/Configuration
52-
* The rest of the [api / command line interface](https://github.com/pattern-lab/patternlab-node/wiki/Command-Line-Interface) is documented in the wiki, and already implemented for you within [Node Editions](https://github.com/pattern-lab?utf8=%E2%9C%93&query=edition-node).
53-
A [full-featured command line interface](https://github.com/pattern-lab/patternlab-node-cli) is in the works, courtesy of [@raphaelokon](https://github.com/raphaelokon).
73+
* Read more about [configuration](https://github.com/pattern-lab/patternlab-node/wiki/Configuration) via `patternlab-config.json`.
74+
75+
* Read more about the rest of [api](https://github.com/pattern-lab/patternlab-node/wiki/Public-API), and already implemented for you within [Editions](#editions).
76+
77+
* A full-featured [command line interface](https://github.com/pattern-lab/patternlab-node-cli) is also available courtesy of [@raphaelokon](https://github.com/raphaelokon).
78+
5479

80+
### Events
81+
82+
Many [events](https://github.com/pattern-lab/patternlab-node/wiki/Creating-Plugins#events) are emitted during Pattern Lab operations, originally built to support plugins. Below is a sample, allowing users to be informed of asset or pattern changes.
83+
84+
``` javascript
85+
86+
patternlab.serve(...);
87+
88+
patternlab.events.on('patternlab-asset-change', (data) => {
89+
console.log(data); // {file: 'path/to/file.css', dest: 'path/to/destination'}
90+
});
91+
92+
patternlab.events.on('patternlab-pattern-change', (data) => {
93+
console.log(data); // {file: 'path/to/file.ext'}
94+
});
95+
96+
patternlab.events.on('patternlab-global-change', (data) => {
97+
console.log(data); // {file: 'path/to/file.ext'}
98+
});
99+
100+
```
55101

56102
## Development Installation / Workflow
57103

@@ -63,7 +109,7 @@ cd /patternlab-node
63109
git clone https://github.com/pattern-lab/patternlab-node.git
64110
npm install
65111
npm link
66-
cd location/of/edition
112+
cd location/of/editionOrSourceAndConfig
67113
npm link patternlab-node
68114
```
69115

@@ -72,7 +118,7 @@ The above is a bit verbose, but illustrates:
72118
1. how to clone this repository to an arbitrary location
73119
2. install all dependencies (run `npm install --dev` if your NODE_ENV is production for some reason)
74120
3. setup the `npm link` to your local copy
75-
4. use the local copy of patternlab-node in your edition
121+
4. use the local copy of patternlab-node in your edition / working directory
76122

77123
> Make sure to change to whichever branch you intend to hack on or test within your cloned repository, such as `dev` or `bugfix/fixes-broken-unittest`
78124

0 commit comments

Comments
 (0)