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 |
|
6 | Copy multiple trees of files on top of each other, resulting in a single merged tree.
|
7 |
|
8 | ## Installation
|
9 |
|
10 | ```bash
|
11 | npm install --save-dev broccoli-merge-trees
|
12 | ```
|
13 |
|
14 | ## Usage
|
15 |
|
16 | ```js
|
17 | var BroccoliMergeTrees = require('broccoli-merge-trees');
|
18 |
|
19 | var 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 |
|
37 | If this is your `Brocfile.js`:
|
38 |
|
39 | ```js
|
40 | var BroccoliMergeTrees = require('broccoli-merge-trees');
|
41 |
|
42 | module.exports = new BroccoliMergeTrees(['public', 'scripts']);
|
43 | ```
|
44 |
|
45 | And 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 |
|
57 | Then 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 |
|
65 | The 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 |
|
69 | Clone this repo and run the tests like so:
|
70 |
|
71 | ```
|
72 | npm install
|
73 | npm test
|
74 | ```
|
75 |
|
76 | Issues 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.
|