Skip to content

Commit 4855419

Browse files
Merge pull request #725 from pattern-lab/724-readme
724 readme
2 parents e9fb138 + 117e05e commit 4855419

File tree

1 file changed

+63
-8
lines changed

1 file changed

+63
-8
lines changed

README.md

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +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 Core is designed to be consumed, and by default is included as a dependency within two example [Node Editions](https://github.com/pattern-lab?utf8=%E2%9C%93&query=edition-node).
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+
### Direct Consumption
27+
28+
As of Pattern Lab Node 3.X, `patternlab-node` can run standalone, without the need for task runners like gulp or grunt.
29+
30+
`npm install patternlab-node`
31+
32+
See [Usage](#Usage) for more information.
33+
34+
### Editions
35+
36+
For users wanting a more pre-packaged experience several editions are available.
2637

2738
* [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.
2839
* [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.
40+
* [Pattern Lab/Node: Vanilla Edition](https://github.com/pattern-lab/edition-node) contains info how to get started within a pure node environment.
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
2945

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

32-
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.
48+
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.
3349

3450
## Usage
3551

52+
`patternlab-node` can be required within any Node environment, taking in a configuration file at instantiation.
53+
3654
``` javascript
55+
3756
const config = require('./patternlab-config.json');
3857
const patternlab = require('patternlab-node')(config);
39-
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+
4071
```
4172

42-
* Read more about configuration via `patternlab-config.json`: https://github.com/pattern-lab/patternlab-node/wiki/Configuration
43-
* 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).
44-
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`.
4574

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+
79+
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+
```
46101

47102
## Development Installation / Workflow
48103

@@ -54,7 +109,7 @@ cd /patternlab-node
54109
git clone https://github.com/pattern-lab/patternlab-node.git
55110
npm install
56111
npm link
57-
cd location/of/edition
112+
cd location/of/editionOrSourceAndConfig
58113
npm link patternlab-node
59114
```
60115

@@ -63,7 +118,7 @@ The above is a bit verbose, but illustrates:
63118
1. how to clone this repository to an arbitrary location
64119
2. install all dependencies (run `npm install --dev` if your NODE_ENV is production for some reason)
65120
3. setup the `npm link` to your local copy
66-
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
67122

68123
> 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`
69124

0 commit comments

Comments
 (0)