UNPKG

2.03 kBMarkdownView Raw
1# broccoli-merge-trees
2
3[![Build Status](https://travis-ci.org/broccolijs/broccoli-merge-trees.svg?branch=master)](https://travis-ci.org/broccolijs/broccoli-merge-trees)
4[![Build status](https://ci.appveyor.com/api/projects/status/9fkvegf4qbvfsg5v?svg=true)](https://ci.appveyor.com/project/embercli/broccoli-merge-trees)
5
6Copy multiple trees of files on top of each other, resulting in a single merged tree.
7
8## Installation
9
10```bash
11npm install --save-dev broccoli-merge-trees
12```
13
14## Usage
15
16```js
17var BroccoliMergeTrees = require('broccoli-merge-trees');
18
19var mergedNode = new BroccoliMergeTrees(inputNodes, options);
20```
21
22* **`inputNodes`**: An array of nodes, whose contents will be merged
23
24* **`options`**: A hash of options
25
26### Options
27
28* `overwrite`: By default, broccoli-merge-trees throws an error when a file
29 exists in multiple nodes. If you pass `{ overwrite: true }`, the output
30 will contain the version of the file as it exists in the last input
31 node that contains it.
32
33* `annotation`: A note to help tell multiple plugin instances apart.
34
35### Example
36
37If this is your `Brocfile.js`:
38
39```js
40var BroccoliMergeTrees = require('broccoli-merge-trees');
41
42module.exports = new BroccoliMergeTrees(['public', 'scripts']);
43```
44
45And your project contains these files:
46
47 .
48 ├─ public
49 │ ├─ index.html
50 │ └─ images
51 │ └─ logo.png
52 ├─ scripts
53 │ └─ app.js
54 ├─ Brocfile.js
55
56
57Then running `broccoli build the-output` will generate this folder:
58
59 the-output
60 ├─ app.js
61 ├─ index.html
62 └─ images
63 └─ logo.png
64
65The parent folders, `public` and `scripts` in this case, are not included in the output. The output tree contains only the files *within* each folder, all mixed together.
66
67## Contributing
68
69Clone this repo and run the tests like so:
70
71```
72npm install
73npm test
74```
75
76Issues and pull requests are welcome. If you change code, be sure to re-run
77`npm test`. Oftentimes it's useful to add or update tests as well.