Skip to content
Concatenate file contents with a custom separator and generate a source map
Branch: master
Clone or download
Florian Reiterer
Florian Reiterer v1.1.0
Latest commit fa7922b May 2, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
test Fix: support for Node < v4 Apr 28, 2018
.gitignore version 0.1.0 Jul 8, 2014
.jshintrc version 0.1.0 Jul 8, 2014
.travis.yml Fix: support for Node < v4 Apr 28, 2018 add license title Oct 10, 2016 Add possibility to add content without file reference (e.g. header co… Sep 27, 2015
index.d.ts Add TypeScript types May 2, 2018
index.js Add TypeScript types May 2, 2018
package.json v1.1.0 May 2, 2018

Concat with source maps NPM version build status Test coverage

NPM module for concatenating files and generating source maps.

Usage example

var concat = new Concat(true, 'all.js', '\n');
concat.add(null, "// (c) John Doe");
concat.add('file1.js', file1Content);
concat.add('file2.js', file2Content, file2SourceMap);

var concatenatedContent = concat.content;
var sourceMapForContent = concat.sourceMap;


new Concat(generateSourceMap, outFileName, separator)

Initialize a new concat object.


  • generateSourceMap: whether or not to generate a source map (default: false)
  • outFileName: the file name/path of the output file (for the source map)
  • separator: the string that should separate files (default: no separator)

concat.add(fileName, content, sourceMap)

Add a file to the output file.


  • fileName: file name of the input file (can be null for content without a file reference, e.g. a license comment)
  • content: content (Buffer or string) of the input file
  • sourceMap: optional source map of the input file (string). Will be merged into the output source map.


The resulting concatenated file content (Buffer).


The resulting source map of the concatenated files (string).

You can’t perform that action at this time.