# broccoli-concat

> Fast, good-enough concatenation with source maps.

Latest version **4.2.7** (published 2026-02-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install broccoli-concat
pnpm add broccoli-concat
yarn add broccoli-concat
bun add broccoli-concat
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: no vulnerabilities; has provenance.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 4.2.7 |
| Published | 2026-02-11 |
| First published | 2014-02-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 10.* \|\| >= 12.* |
| Dependencies | 8 |
| Unpacked size | 19.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 18 |
| Author | Edward Faulkner |
| Maintainers | joliss, real_ate, rwjblue, katiegengler, stefanpenner |
| Keywords | broccoli-plugin |

## Links

- npm: https://www.npmjs.com/package/broccoli-concat
- Repository: https://github.com/broccolijs/broccoli-concat
- Homepage: https://github.com/broccolijs/broccoli-concat#readme
- Issues: https://github.com/broccolijs/broccoli-concat/issues
- npm.io page: https://npm.io/package/broccoli-concat

## Dependencies (8)

- [lodash](https://npm.io/package/lodash.md) ^4.17.23
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [find-index](https://npm.io/package/find-index.md) ^1.1.0
- [fs-tree-diff](https://npm.io/package/fs-tree-diff.md) ^2.0.1
- [broccoli-debug](https://npm.io/package/broccoli-debug.md) ^0.6.5
- [broccoli-plugin](https://npm.io/package/broccoli-plugin.md) ^4.0.2
- [ensure-posix-path](https://npm.io/package/ensure-posix-path.md) ^1.0.2
- [fast-sourcemap-concat](https://npm.io/package/fast-sourcemap-concat.md) ^2.1.0

## Recent versions

- 4.2.7 (latest) — 2026-02-11
- 4.2.5 — 2021-04-14
- 4.2.4 — 2020-03-30
- 4.2.3 — 2020-02-20
- 4.2.2 — 2019-12-16
- 4.2.1 — 2019-12-16
- 4.2.0 — 2019-12-05
- 4.1.0 — 2019-12-05
- 4.0.0 — 2019-12-04
- 3.7.5 — 2019-11-11
- 3.7.4 — 2019-07-23
- 3.7.3 — 2018-10-05
- 3.7.2 — 2018-10-04
- 3.7.1 — 2018-08-28
- 3.7.0 — 2018-08-23
- … 46 more at https://npm.io/package/broccoli-concat/versions

## README

Broccoli concatenator that generates & propagates sourcemaps
-------------------------------------------------

[![Build Status](https://travis-ci.org/ef4/broccoli-sourcemap-concat.svg?branch=master)](https://travis-ci.org/ef4/broccoli-sourcemap-concat)
[![Build status](https://ci.appveyor.com/api/projects/status/bpxeh0we50eod6xw/branch/master?svg=true)](https://ci.appveyor.com/project/embercli/broccoli-sourcemap-concat/branch/master)

This filter is designed to be fast & good enough. It can generates
source maps substantially faster than you'll get via
mozilla/source-map, because it's special-cased for straight
line-to-line contenation.

It discovers input sourcemaps in relative URLs, including data URIs.


### Usage

```js
const node = concat(node);
```

#### Advanced Usage

```js
const node = concat(node, {
  outputFile: '/output.js',
  header: ";(function() {",
  headerFiles: ['loader.js'],
  inputFiles: ['**/*'],
  footerFiles: ['auto-start.js'],
  footer: "}());",
  sourceMapConfig: { enabled: true },
  allowNone: false | true // defaults to false, and will error if trying to concat but no files are found.
});
```

The structure of `output.js` will be as follows:

```
// - header
// - ordered content of the files in headerFiles
// - un-ordered content of files matched by inputFiles, but not in headerFiles or footerFiles
// - ordered content of the files in footerFiles
// - footer
```

#### Debug Usage

*note: this is intended for debugging purposes only, and will most likely negatively affect your build performace is left enabled*

Setting the environment variable `CONCAT_STATS=true` will result a summary of
each concatention being output to `process.cwd() + 'concat-stats-for/*.json'`

Each file within that directory represents a different contenation, and will contain:

* outputFile – the output file that was created
* sizes – a summary of each input file, and the associated pre-minified pre-gziped byte size.

Want more details? like uglified or compressed sizes? (or have more ideas) go checkout: https://github.com/stefanpenner/broccoli-concat-analyser

##### Example:

concat-stats-for/<id>-file.json
```json
{
  "outputFile": "path/to/output/File",
  "sizes": {
    "a.js": 5,
    "b.js": 10,
  }
}
```

other files:

* concat-stats-for/<id>-file/a.js
* concat-stats-for/<id>-file/b.js

---
_Source: https://npm.io/package/broccoli-concat · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
