broccoli-merge-trees
Broccoli plugin to merge multiple trees into one
Last updated a month ago by stefanpenner .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install broccoli-merge-trees 
SYNC missed versions from official npm registry.

broccoli-merge-trees

Build Status Build status

Copy multiple trees of files on top of each other, resulting in a single merged tree.

Installation

npm install --save-dev broccoli-merge-trees

Usage

  • As a function call
const broccoliMergeTrees = require('broccoli-merge-trees');

let mergedNode = broccoliMergeTrees(inputNodes, options);
  • With new
const { MergeTrees } = require('broccoli-merge-trees');

let mergedNode = new MergeTrees(inputNodes, options);
  • inputNodes: An array of nodes, whose contents will be merged

  • options: A hash of options

Options

  • overwrite: By default, broccoli-merge-trees throws an error when a file exists in multiple nodes. If you pass { overwrite: true }, the output will contain the version of the file as it exists in the last input node that contains it.

  • annotation: A note to help tell multiple plugin instances apart.

  • destDir: A string representing the destination path that merged files will be copied to.

Example

If this is your Brocfile.js:

const mergeTrees = require('broccoli-merge-trees');

module.exports = function() {
  return mergeTrees(['public','scripts']);
};

And your project contains these files:

.
├─ public
│  ├─ index.html
│  └─ images
│     └─ logo.png
├─ scripts
│  └─ app.js
├─ Brocfile.js
…

Then running broccoli build the-output will generate this folder:

the-output
├─ app.js
├─ index.html
└─ images
   └─ logo.png

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.


If this is your Brocfile.js:

var BroccoliMergeTrees = require('broccoli-merge-trees');

module.exports = new BroccoliMergeTrees(['public', 'scripts'], {
    destDir: 'assets'
});

Then running broccoli build the-output will generate this folder:

the-output
└─ assets
    ├─ app.js
    ├─ index.html
    └─ images
    └─ logo.png

Contributing

Clone this repo and run the tests like so:

npm install
npm test

Issues and pull requests are welcome. If you change code, be sure to re-run npm test. Oftentimes it's useful to add or update tests as well.

Current Tags

  • 4.1.0                                ...           latest (a month ago)

26 Versions

  • 4.1.0                                ...           a month ago
  • 4.0.0                                ...           2 months ago
  • 3.0.2                                ...           a year ago
  • 2.0.1                                ...           a year ago
  • 3.0.1                                ...           a year ago
  • 3.0.0                                ...           2 years ago
  • 2.0.0                                ...           3 years ago
  • 1.2.4                                ...           3 years ago
  • 1.2.3                                ...           3 years ago
  • 1.2.2                                ...           3 years ago
  • 1.2.1                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.5                                ...           3 years ago
  • 1.1.4                                ...           3 years ago
  • 1.1.3                                ...           3 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.2.4                                ...           4 years ago
  • 0.2.3                                ...           4 years ago
  • 0.2.2                                ...           5 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.4                                ...           6 years ago
  • 0.1.3                                ...           6 years ago
Downloads
Today 0
This Week 9
This Month 762
Last Day 9
Last Week 203
Last Month 1,464
Dependencies (2)
Dev Dependencies (5)
Dependents (900)

Copyright 2014 - 2016 © taobao.org |